question

Prags-8042 avatar image
0 Votes"
Prags-8042 asked KranthiPakala-MSFT answered

Azure devops ADF pre and post deployment script

I am using pre post deployment script from Azure page in the ADF devops pipeline. The first task uses these parameters.
-armTemplate "$(System.DefaultWorkingDirectory)/<your-arm-template-location>" -ResourceGroupName <your-resource-group-name> -DataFactoryName <your-data-factory-name> -predeployment $true -deleteDeployment $false


Then the ARM deployment and next task uses
-armTemplate "$(System.DefaultWorkingDirectory)/<your-arm-template-location>" -ResourceGroupName <your-resource-group-name> -DataFactoryName <your-data-factory-name> -predeployment $false -deleteDeployment $true.

The third task deletes everything in the ADF. I just wanted to remove the old pipelines that doesn't exist in my master pipeline or ADFPublish branch. Do I have to make any changes in that script to handles this ?


azure-data-factory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KranthiPakala-MSFT avatar image
0 Votes"
KranthiPakala-MSFT answered

Hello @Prags-8042,

Thanks for the question and using MS Q&A platform.

The -deleteDeployment flag is used to specify the deletion of the ADF deployment entry from the deployment history in ARM. In the post-deployment script, you will specify the below variation of parameters/arguments which includes code to delete resources (unwanted resources like pipelines, datasets, dataflows, linked services, integration runtimes) that have been removed in the current deployment (Nothing but deletes resources which are present in last deployment(ARM) but not in current deployment(ARM) from deployment history).

Post-deployment script - which will start your triggers once after the cleanup (delete) of unwanted resources is completed.

 -armTemplate "$(System.DefaultWorkingDirectory)/<your-arm-template-location>" -ResourceGroupName <your-resource-group-name> -DataFactoryName <your-data-factory-name> -predeployment $false -deleteDeployment $true.

This will execute below piece of code from the script provided in the public documentation:

194433-image.png


This is a sample script provided by ADF product team, but you can alter the script as per your custom requirement. In case if you have few resources like pipelines/datasets/linked services that are removed in the current deployment but were present in the previous deployment then you can just use the same post-deployment script provided in the doc to get rid of the unwanted resources.

Hope this clarifies.


image.png (63.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Prags-8042,

Just checking in to see if the above information was helpful. And, if you have any further query do let us know.

0 Votes 0 ·