0
votes

I tried to deploy ARM template for azure Data Factory as part of DevOps implementation.

Mode of deployment was selected as complete in oreder to cleanup the existing adf instance and deploy only the pipelines that are available in ARM template. as shown below.enter image description here

When I tried to run the deployment, It failed with an error as

##[error]The deployment failed because some resources could not be deleted. This might be due to not having permissions to delete resources in the targeted scope. Please see https://aka.ms/arm-debug for usage details.
2020-11-02T05:33:34.5795133Z ##[error]Check out the troubleshooting guide to see if your issue is addressed: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting

When I did a debug on this issue, i could understand that the deployment scope is selected as Resource Group and deployment task tried to delete all the resources under this resource group and failed because it couldnt delete resources other than ADF instance because of access issues. enter image description here

Since I do not have access to other resources, they were not deleted, otherwise i could have messed up everything by deleting all other resources like ADLS, databricks, sql....

Since I am deploying ADF ARM template is there any way to restrict the deployment scope only for ADF instance, which will not affect other resources.

Any leads appreciated!

I have a query about the What-If feature provided by azure for ARM template deployment. Can we use this in our Release pipeline as a powershell task?

2

2 Answers

1
votes

You cannot restrict the deployment scope lower than the ResourceGroup as you noticed.

The only way for you to do this would be either putting the ADF in a seperate resource group but i asume that is not possible.

A second way of doing this would be deleting the ADF through the portal or powershell and then do an incremental deployment of you ARM template that has only the ADF definition in it.

Microsoft rolled out a new feature for ARM deployments called What-If. This is a super nice feature to check what changes to what resources will happen when deploying your template. Note, it only works with powershell core at the moment. If you work with ARM templates this could help you and catch resource deletion before you deploy anything.

0
votes

When deploying a data factory, do not select Complete as your deployment mode. This will overwrite all resources in the resource group including non-ADF entities.

Selecting Incremental will deploy only the resources located in the ARM template. If generated from the adf_publish branch, then this will contain all of the resources in your factory.