Abandoned Flow Auto-Disable Workflow
Power Automate for Admins finds flows with zero runs in 60+ days. Sends a Teams adaptive card to the owner to confirm or archive. On timeout, disables the flow and logs the action to Dataverse.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
A weekly governance flow that scans the target Power Platform environment for cloud flows that have not been modified in a configurable number of days (default: 60). For each abandoned flow, it posts a Teams adaptive card to the admin channel with flow details and action buttons. If the admin responds Keep Active, the decision is logged. If no response within 3 days (or Disable is selected), the flow is automatically stopped via the Power Automate Management connector and the action is logged to a Dataverse audit table.
Use Case
Scheduled scan -> filter -> interactive review -> automated enforcement -> audit logging. The flow combines a weekly Recurrence trigger with the Power Automate Management connector to inventory environment flows, then uses Teams adaptive cards with a 3-day timeout to give owners a chance to keep a flow active before it is auto-disabled. Every keep/disable decision is written to a Dataverse audit table so admins have a complete compliance trail.
The flow is ideal for teams that:
- IT admins who need to reclaim quota and reduce sprawl from unused cloud flows
- Center of Excellence teams enforcing Power Platform governance and audit policies
- Environments where flow owners should be given a chance to confirm before automated disable
- Organizations that require a Dataverse-backed audit trail of governance decisions
Flow Architecture
Weekly Recurrence
RecurrenceRuns weekly on Monday at 7:00 AM Eastern to scan the target environment for abandoned flows.
Initialize Variables (6x parallel)
Initialize variableLoads env vars in parallel: abandoned days threshold (cast int), Teams group ID, Teams channel ID, admin notification email, target environment ID, and a disabled-count integer counter.
Compose Cutoff Date
ComposeaddDays(utcNow(), mul(-1, varAbandonedDaysThreshold)). Any flow last modified before this is abandoned.
List Environment Flows
Power Automate Management ListFlowsInEnvironment_V2Enumerates all cloud flows in the target environment with state and lastModifiedTime.
Filter Abandoned Flows
Filter arrayKeeps flows where state = Started AND lastModifiedTime is less than the cutoff date.
Apply to each Abandoned Flow
Apply to eachFor each abandoned flow: computes days inactive, builds an adaptive card, posts it to the admin channel and waits up to 3 days for a response, then branches on the response.
If Owner Keeps Flow Active
If conditionRoutes the adaptive card response (or timeout) to the right downstream action.
- Dataverse CreateRecord (Kept Active) — Inserts a row into flowlibs_abandonedflowactions with actiontaken = 'Kept Active'.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_AbandonedFlowDays | String | 60 | Days of inactivity before a flow is treated as abandoned. Cast to int via @int(). |
| flowlibs_AdminTeamsGroupId | String | 00000000-... | Teams group that hosts the admin governance channel. |
| flowlibs_AdminTeamsChannelId | String | 19:0000...@thread.tacv2 | Teams channel for adaptive cards and summary messages. |
| flowlibs_AdminNotificationEmail | String | admin@contoso.com | Fallback notification recipient when Teams cannot be used. |
| flowlibs_TargetEnvironmentId | String | default-794c40ea-... | Power Platform environment GUID scanned by ListFlowsInEnvironment_V2 and StopFlow. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Power Automate Management | shared_flowmanagement | ListFlowsInEnvironment_V2 (Enumerates flows in the target environment) StopFlow (Disables an abandoned flow) |
| Microsoft Teams | shared_teams | PostCardAndWaitForResponse (Adaptive card with P3D timeout) PostMessageToConversation (Post-run summary to admin channel) |
| Microsoft Dataverse | shared_commondataserviceforapps | CreateRecord (Writes Kept Active and Disabled rows to flowlibs_abandonedflowactions) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Tune the staleness threshold
- Change flowlibs_AbandonedFlowDays (default 60) to match your governance policy. The value is cast via @int() at runtime.
- Adjust the owner response window
- Teams PostCardAndWaitForResponse uses P3D (3-day) timeout. Edit duration to give owners more or less time before timeout is treated as implicit consent.
- Switch from lastModifiedTime to run-history checks
- ListFlowsInEnvironment_V2 returns metadata but not run counts. Add a per-flow ListFlowRuns lookup inside Apply to each and filter on recent runs instead.
- Retarget the admin channel and environment
- Update flowlibs_AdminTeamsGroupId, flowlibs_AdminTeamsChannelId, and flowlibs_TargetEnvironmentId before enabling.
- Extend the Dataverse audit columns
- flowlibs_abandonedflowactions can be extended (owner, environment, justification) and CreateRecord updated to populate them.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Cutoff date for abandoned flows
Used in Compose Cutoff Date.
EXPR.02Days inactive per flow
Inside Apply to each. Tick delta to whole days.
EXPR.03Filter Array predicate
Filters to running flows whose last modification is older than the cutoff.
EXPR.04Integer cast on the threshold env var
Env var is stored as string; cast to int for date math.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.