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!
- Azure Data Factory / Synapse
Here’s how you can cancel the pipeline run directly from Azure Data Factory / Synapse:
- Grant the Azure Data Factory / Synapse Data Factory Contributor access to the Data Factory whose pipeline execution needs to be canceled.
- Use ADF / Synapse Web Activity and the ADF REST API to cancel the Pipeline run.
- Set the Pipeline Parameters
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.
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.
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.
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' )
Authentication: System Assigned Managed Identity
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!