Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save axis7818/9dfd8e70eb113043d6f262cbbc5ff919 to your computer and use it in GitHub Desktop.
Save axis7818/9dfd8e70eb113043d6f262cbbc5ff919 to your computer and use it in GitHub Desktop.
ACR With Geo-Replication Complete Mode ARM Deployment

101-container-registry-geo-replication

Issue Details

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.

Repro steps

  1. Create a new resource group
  2. Deploy this ARM template with Complete mode: az group deployment create . . . --mode Complete
  3. View the deployment in the Azure portal and see that it never finishes, but repeatedly shows an error event: HomeReplicationCannotBeDeleted

Work-Around

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment