web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Cannot Delete Rogue Flow
Power Automate
Unanswered

Cannot Delete Rogue Flow

(1) ShareShare
ReportReport
Posted on by 8
 
 
I am using the following PS and cannot delete an orphaned flow.  It has been deleted from Power Automate however in the Power Platform Admin Center it still appears within Flows.  This is am e-mail distribution Flow for Power BI paginated reports which I am BCC on so I know that the Flow is still active as I am receiving the communications in my Inbox.
 
# Specify the target environment name
$environmentName = 'Default-2e3ae2ce-642b-49a6-9f6b-2217d5a549ec'
# Specify the flow name or a partial match for the flow to be deleted
$flowNameToMatch = "Test - PA - MES Transactions Not Posted"
# Get all flows in the specified environment
$flows = Get-AdminFlow -EnvironmentName $environmentName
# Find the target flow by display name
$targetFlow = $flows | Where-Object {$_.DisplayName -like $flowNameToMatch}
# Check if the flow was found
if ($targetFlow) {
    # Prompt for confirmation before deleting
    $confirmation = Read-Host "Are you sure you want to delete the flow '$($targetFlow.DisplayName)' in environment '$environmentName'? (Y/N)"
    if ($confirmation -ceq "Y") {
        try {
            # Attempt to delete the flow
            Remove-AdminFlow -EnvironmentName $targetFlow.EnvironmentName -FlowName $targetFlow.FlowName
            # Wait for a short period to allow the deletion to propagate (optional, but can help with immediate confirmation)
            Start-Sleep -Seconds 5
            # Verify if the flow is no longer present
            $deletedFlow = Get-AdminFlow -EnvironmentName $environmentName | Where-Object {$_.FlowName -eq $targetFlow.FlowName}
            if (-not $deletedFlow) {
                Write-Host "Successfully deleted flow '$($targetFlow.DisplayName)' in environment '$environmentName'." -ForegroundColor Green
            } else {
                Write-Warning "Deletion of flow '$($targetFlow.DisplayName)' might have failed or the flow is still present."
            }
        }
        catch {
            Write-Error "An error occurred while trying to delete the flow: $($_.Exception.Message)"
        }
    } else {
        Write-Host "Deletion of flow '$($targetFlow.DisplayName)' cancelled by user." -ForegroundColor Yellow
    }
} else {
    Write-Warning "No flow found matching the name '$flowNameToMatch' in environment '$environmentName'."
}
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,493 Super User 2025 Season 2 on at
     
    Please leverage this
     
     
    You can either delete it or get a better idea / error of why not.
     
    If that Helps, please mark as such and maybe a like :-)
     
    Thanks!
  • BG-15041112-0 Profile Picture
    8 on at
    Unfortunately, I have been using this reference and still have a situation.
     
  • BG-15041112-0 Profile Picture
    8 on at
    I also can provide this detail as well
     
  • BG-15041112-0 Profile Picture
    8 on at
    Update
     
    I ran this PowerShell script and got the Flow restored so that I was able to disable it.
     
    #Test - PA - MES Transactions Not Posted
    #Restore-AdminFlow -EnvironmentName Default-2e3ae2ce-642b-49a6-9f6b-2217d5a549ec -FlowName daa2cd20-07af-4859-ab0f-28dd727e7458
     
    However, now I am in need of a script to find the FlowName as the page is erroring out.
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard