Microsoft Power Automate · Arazzo Workflow

Microsoft Power Automate Retire a Flow Safely

Version 1.0.0

Check a flow for in-flight runs, deactivate it, and then delete it.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub AutomationBusiness ProcessIntegrationLow-CodeMicrosoftPower PlatformRPAWorkflowsArazzoWorkflows

Provider

microsoft-power-automate

Workflows

retire-flow
Deactivate and delete a flow after confirming no runs are in flight.
Captures the flow record for the audit trail, inspects the run history for in-flight executions, stops the flow, and deletes it.
4 steps inputs: environmentName, flowName outputs: finalRunHistory, retiredFlowCreator, retiredFlowDisplayName
1
captureFlowRecord
Read the flow one last time so its display name, creator, and definition summary are captured for the retirement record before deletion removes them.
2
checkRunHistory
List the flow's run history and check for executions still in flight. A Running or Waiting run means the flow should not be deleted yet.
3
deactivateFlow
Stop the flow so its trigger cannot start a new run between this check and the delete.
4
deleteFlow
Delete the now-quiet flow from the environment. This is irreversible; the captured flow record from the first step is the only remaining trace.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Microsoft Power Automate Retire a Flow Safely
  summary: Check a flow for in-flight runs, deactivate it, and then delete it.
  description: >-
    Deleting a flow that still has work in flight destroys run history an
    operator may need and can strand partially completed business processes.
    This workflow retires a flow the careful way: read the flow to capture what
    is about to be removed, list its recent runs to check nothing is still
    running, deactivate the trigger so no new runs start, and only then delete
    it. Every step spells out its request inline so the flow can be read and
    executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: flowRunsApi
  url: ../openapi/microsoft-power-automate-flow-runs-api-openapi.yml
  type: openapi
- name: flowsApi
  url: ../openapi/microsoft-power-automate-flows-api-openapi.yml
  type: openapi
workflows:
- workflowId: retire-flow
  summary: Deactivate and delete a flow after confirming no runs are in flight.
  description: >-
    Captures the flow record for the audit trail, inspects the run history for
    in-flight executions, stops the flow, and deletes it.
  inputs:
    type: object
    required:
    - environmentName
    - flowName
    properties:
      environmentName:
        type: string
        description: The name of the environment holding the flow.
      flowName:
        type: string
        description: The name or ID of the flow to retire.
  steps:
  - stepId: captureFlowRecord
    description: >-
      Read the flow one last time so its display name, creator, and definition
      summary are captured for the retirement record before deletion removes them.
    operationId: getFlow
    parameters:
    - name: environmentName
      in: path
      value: $inputs.environmentName
    - name: flowName
      in: path
      value: $inputs.flowName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      displayName: $response.body#/properties/displayName
      state: $response.body#/properties/state
      creator: $response.body#/properties/creator
      definitionSummary: $response.body#/properties/definitionSummary
  - stepId: checkRunHistory
    description: >-
      List the flow's run history and check for executions still in flight. A
      Running or Waiting run means the flow should not be deleted yet.
    operationId: listFlowRuns
    parameters:
    - name: environmentName
      in: path
      value: $inputs.environmentName
    - name: flowName
      in: path
      value: $inputs.flowName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      runs: $response.body#/value
      mostRecentRunStatus: $response.body#/value/0/properties/status
    onSuccess:
    - name: noRunsInFlight
      type: goto
      stepId: deactivateFlow
      criteria:
      - context: $response.body
        condition: $.value[?(@.properties.status == 'Running' || @.properties.status == 'Waiting')].length == 0
        type: jsonpath
    - name: runsStillInFlight
      type: end
      criteria:
      - context: $response.body
        condition: $.value[?(@.properties.status == 'Running' || @.properties.status == 'Waiting')].length > 0
        type: jsonpath
  - stepId: deactivateFlow
    description: >-
      Stop the flow so its trigger cannot start a new run between this check and
      the delete.
    operationId: turnOffFlow
    parameters:
    - name: environmentName
      in: path
      value: $inputs.environmentName
    - name: flowName
      in: path
      value: $inputs.flowName
    successCriteria:
    - condition: $statusCode == 200
  - stepId: deleteFlow
    description: >-
      Delete the now-quiet flow from the environment. This is irreversible; the
      captured flow record from the first step is the only remaining trace.
    operationId: deleteFlow
    parameters:
    - name: environmentName
      in: path
      value: $inputs.environmentName
    - name: flowName
      in: path
      value: $inputs.flowName
    successCriteria:
    - condition: $statusCode == 204
  outputs:
    retiredFlowDisplayName: $steps.captureFlowRecord.outputs.displayName
    retiredFlowCreator: $steps.captureFlowRecord.outputs.creator
    finalRunHistory: $steps.checkRunHistory.outputs.runs

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/microsoft-power-automate-retire-flow-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.