Data sinks can’t be reused in different settings on the same category for the same resource

Developing Logic Apps in Azure is quite a nice experience. Using the Azure Portal to design and implement your workflow is easy.

Less pleasurable is creating ARM templates for Logic Apps (perhaps another post another time). Let’s just say now that this requires some manual labor, but the results are very rewarding;)

Using Azure DevOps we are deploying our Azure resources into the ‘Development’ Resourcegroup as the first step in our pipeline. In the case of a Logic App this means overwriting the version you created manually in the Portal. This means that you have to verify the ARM template was correct comparing the current version of the Logic App with the previous one.

Another thing that can happen during this process is an error I ran into today for the second time. It can take some time to figure out what exactly happened so I decided to document this for when it happens again…

If you have linked your Logic App to an instance of Log Analytics, either at creation time or later, you can run into this error at the deploy:

Data sink '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-monitoring/providers/Microsoft.OperationalInsights/workspaces/ws-monitoring' is already used in diagnostic setting 'service' for category 'WorkflowRuntime'. Data sinks can't be reused in different settings on the same category for the same resource. (Code: Conflict)

To resolve this error you have to delete the existing diagnostic setting, so ARM can deploy a new one and will not see this setting as duplicate. Subsequent deployments will succeed after this change.