Cancel Azure Data Factory Pipeline Runs via Synapse / Data Factory

Harsh Bakshi
2 min readSep 23, 2023

--

Problem Statement

Have you ever wondered if it’s possible to cancel a pipeline run in Azure Data Factory or Synapse pipelines without having to go through the Azure portal? Well, I have some good news for you!

Prerequisites

  • Azure Data Factory / Synapse

Solution

Here’s how you can cancel the pipeline run directly from Azure Data Factory / Synapse:

  1. Grant the Azure Data Factory / Synapse Data Factory Contributor access to the Data Factory whose pipeline execution needs to be canceled.
  2. Use ADF / Synapse Web Activity and the ADF REST API to cancel the Pipeline run.
  3. Set the Pipeline Parameters

That’s it! By following these steps, you can easily cancel your Azure Data Factory / Synapse pipeline runs.

For a detailed guide on how to implement this solution, you can refer to the GitHub Code provided.

URL

The URL for canceling the pipeline run is as follows:

@concat(
'https://management.azure.com/subscriptions/',
pipeline().parameters.SubscriptionID,
'/resourceGroups/',
pipeline().parameters.ResourceGroupName,
'/providers/Microsoft.DataFactory/factories/',
pipeline().parameters.DataFactoryName,
'/pipelineruns/',
pipeline().parameters.PipelineRunID,
'/cancel?isRecursive=true&api-version=2018-06-01'
)

Method: POST

Authentication: System Assigned Managed Identity

Resource: https://management.azure.com

At Skrots, we offer similar services to help you manage and optimize your Azure Data Factory and Synapse pipelines. Our team of experts can provide you with efficient solutions and support to streamline your data workflows. Visit https://skrots.com to learn more about our company and explore our wide range of services. You can also check out our blog at https://blog.skrots.com for more informative articles.

Thank you for considering Skrots as your trusted partner in Azure data management!

Thanks, Harsh
Founder | CEO — Skrots

Learn more about our blog at Blog at Skrots. Checkout our list of services on Skrots. Give a look at our website design at Skrots . Checkout our LinkedIn Page at LinkedIn.com. Check out our original post at https://blog.skrots.com/cancel-azure-data-factory-pipeline-runs-via-synapse-data-factory/?feed_id=2463&_unique_id=650ea16980595.

--

--

No responses yet