Coder Perfect

Bicep deployment of Microsoft.Web/sites/siteextensions with appservice fails with ‘Canceled’ error

Problem

Using this example from the Azure quickstart templates as a guide,

https://github.com/Azure/azure-quickstart-templates/blob/master/quickstarts/microsoft.web/web-app-loganalytics/main.bicep

When I tried to deploy it, I received the following error:

{
"status": "Failed",
"error": {
    "code": "ResourceDeploymentFailure",
    "message": "The resource operation completed with terminal provisioning state 'Canceled'."
    }
}

With this error, it sometimes succeeds and sometimes fails. What is the source of this? How can we fix this so that deployment doesn’t fail again?

Asked by Paco G

Post is based on https://stackoverflow.com/questions/70473717/bicep-deployment-of-microsoft-web-sites-siteextensions-with-appservice-fails-wit