4

So I have setup a deployment of an Arm Template with some Logic Apps with some related diagnostic setting for Event hub, see img. Event Hub Settings

However, when deploying the same template again, we get the error: "Data sinks can’t be reused in different settings on the same category for the same resource".

And the solution is to remove the diagnostic settings before a new deploy. But I don't want to manually do this each time we do a new deploy.

Have someone figured out a workaround for this?

Thanks!

1 Answers1

3

You can either use PowerShell command or Azure CLI command to remove a diagnostic setting for the resource.

PowerShell command (You can find the documentation here):

Remove-AzDiagnosticSetting -ResourceId "Resource01" -Name myDiagSetting

Azure CLI command (You can find documentation here):

az monitor diagnostic-settings delete --name "myDiagSetting" --resource "Resource01"
Jagrati Modi
  • 2,038
  • 1
  • 13
  • 26
  • 1
    OP said they don't want to manually remove diagnostic settings. This is a manual step and therefore not an answer. – Tom W Sep 07 '20 at 14:54
  • Manually means going to portal again and again and remove it. How will you automate this if you don't use code/logic for this? – Jagrati Modi Sep 09 '20 at 04:21
  • 1
    The question is about the template failing to respect the expected behaviour which is that the same diagnostic setting object, deployed again, will be idempotent if the template is the same. This is not the case from the scenario described by the OP. An ideal answer would describe what you have to do to make the template just work normally. I too have encountered the same problem where numerous logic apps with a diagnostic setting redeploy perfectly and one of them throws this error for no apparent reason, and manually deleting the diagnostic setting doesn't make any difference. – Tom W Sep 09 '20 at 07:12