# 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 `AcrPull` role on the managed identity
    
* Install Az CLI on the VM. Follow the documentation [here](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt&view=azure-cli-latest)
    

## Login to Az CLI using Managed Identity

```bash
az login --identity
```

## Login to ACR

```bash
az acr login —name <registryName>
```

## Pull image from the container

```bash
docker pull <registryName>.azurecr.io/imageName:tag
```
