Exercise - Deploy an Azure container registry

Completed

Important

You need your own Azure subscription to complete this exercise, and you might incur charges. If you don't already have an Azure subscription, create a free account before you begin.

Create an Azure container registry

  1. Launch Azure Cloud Shell and sign in to your Azure account. If you're using Azure CLI from your computer, use the az login command and sign in to your Azure account.

    az login
    
  2. At the top of the Cloud Shell window, select Settings, then select Go to Classic version. The classic version is needed later in this module to use Docker commands.

  3. Verify that the Microsoft.ContainerRegistry and Microsoft.ContainerInstance resource providers are registered in your subscription using the az provider show command.

    az provider show --namespace Microsoft.ContainerRegistry --output table
    
    Namespace                    RegistrationPolicy    RegistrationState
    ---------------------------  --------------------  -------------------
    Microsoft.ContainerRegistry  RegistrationRequired  NotRegistered
    

    Run the following command to register the resource provider if the RegistrationState is NotRegistered.

    az provider register --namespace Microsoft.ContainerRegistry
    
  4. Create a resource group named learn-acr-rg to hold the resources for this module using the az group create command.

    az group create --name learn-acr-rg --location eastus
    
  5. Define an environment variable, ACR_NAME, to hold your container registry name using the following command. Replace <your-unique-acr-name> with your container registry name.

    The container registry name must be unique within Azure and contain 5-50 alphanumeric characters. For more information, see Define your naming convention.

    ACR_NAME=<your-unique-acr-name>
    
  6. Create an Azure container registry using the az acr create command.

    az acr create --resource-group learn-acr-rg --name $ACR_NAME --sku Premium
    

    In this example, we deploy a premium registry SKU required for geo-replication.