Pull images from Azure Container Registry from Azure VM using Managed Identity

This post will describe the required steps to follow in order to pull container images from Azure Container Registry (ACR) using Managed identity attached to the instance.
Managed identity provides seamless authentication to Azure resources.
Prerequisites
Create ACR
Create Azure VM with managed identity attached to it (System or User assigned)
Add
AcrPullrole on the managed identityInstall Az CLI on the VM. Follow the documentation here
Login to Az CLI using Managed Identity
az login --identity
Login to ACR
az acr login —name <registryName>
Pull image from the container
docker pull <registryName>.azurecr.io/imageName:tag




