101-container-registry-geo-replication
I am working on an infrastructure-as-code project that requires the automatic provisioning of ACR with geo-replication. And, I found an issue with ACR and ARM interactions that causes deployment to hang.
I used this template to provision ACR with geo-replication enabled and one additional replication. The goal being to setup a CI pipeline that will provision and apply updates to these resources through a resource group deployment. In order for these automatic updates to happen, I have been trying to use ARM deployments with the Complete mode.
When ACR is provisioned with geo-replication, it automatically creates a home replication resource that is not specified in the ARM template. But, when an ARM deployment uses the Complete mode, it attempts to delete all resources that are not specified in the template. The result is a deployment that hangs with repeated HomeReplicationCannotBeDeleted
errors shown, which is a problem when setting up CI pipelines.
- Create a new resource group
- Deploy this ARM template with Complete mode:
az group deployment create . . . --mode Complete
- View the deployment in the Azure portal and see that it never finishes, but repeatedly shows an error event:
HomeReplicationCannotBeDeleted
The one work-around that I discovered is to include the automatically created home-replication as a resource in an ARM template, but to set its condition
field to always be false. This seems to let ARM know that the resource exists and to not attempt to delete it.