Azure

Cancel Azure Data Factory Pipeline Runs via Synapse / Data Factory

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. To do this, simply login to the Azure Portal, go to the ADF instance, click on Access Control (IAM), and add a role assignment.

    Next, select the Data Factory Contributor role and the necessary Azure Offering in members, then click on Review and assign.

    This will give you the required access to cancel the pipeline run.

  3. Use ADF / Synapse Web Activity and the ADF REST API to cancel the Pipeline run.
  4. You can use the ADF / Synapse Web Activity along with the ADF REST API to cancel the pipeline run. This will allow you to programmatically cancel the run without having to manually go through the Azure portal.

  5. Set the Pipeline Parameters
  6. Make sure to set the necessary pipeline parameters such as SubscriptionID, ResourceGroupName, DataFactoryName, and PipelineRunID.

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!

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button