Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This quickstart shows how to create an Azure Container Registry instance by using a Bicep file.
Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.
If you don't have an Azure subscription, create a free account before you begin.
Use Visual Studio Code or your favorite editor to create a file with the following content and name it main.bicep:
@minLength(5)
@maxLength(50)
@description('Provide a globally unique name of your Azure Container Registry')
param acrName string = 'acr${uniqueString(resourceGroup().id)}'
@description('Provide a location for the registry.')
param location string = resourceGroup().location
@description('Provide a tier of your Azure Container Registry.')
param acrSku string = 'Basic'
resource acrResource 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' = {
name: acrName
location: location
sku: {
name: acrSku
}
properties: {
adminUserEnabled: false
}
}
@description('Output the login server property for later use')
output loginServer string = acrResource.properties.loginServer
The following resource is defined in the Bicep file:
More Azure Container Registry template samples can be found in the quickstart template gallery.
To deploy the file you've created, open PowerShell or Azure CLI. If you want to use the integrated Visual Studio Code terminal, select the ctrl
+ `
key combination. Change the current directory to where the Bicep file is located.
az group create --name myContainerRegRG --location centralus
az deployment group create --resource-group myContainerRegRG --template-file main.bicep --parameters acrName={your-unique-name}
Note
Replace {your-unique-name}, including the curly braces, with a unique container registry name.
When the deployment finishes, you should see a message indicating the deployment succeeded.
Use the Azure portal or a tool such as the Azure CLI to review the properties of the container registry.
In the portal, search for Container Registries, and select the container registry you created.
On the Overview page, note the Login server of the registry. Use this URI when you use Docker to tag and push images to your registry. For information, see Push your first image using the Docker CLI.
When you no longer need the resource, delete the resource group, and the registry. To do so, go to the Azure portal, select the resource group that contains the registry, and then select Delete resource group.
In this quickstart, you created an Azure Container Registry with a Bicep file. Continue to the Azure Container Registry tutorials for a deeper look at ACR.
For a step-by-step tutorial that guides you through the process of creating a Bicep file, see:
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Deploy and use Azure Container Registry - Training
Learn how to create a private registry service for building, storing, and managing container images and related artifacts.
Certification
Microsoft Certified: Azure Administrator Associate - Certifications
Demonstrate key skills to configure, manage, secure, and administer key professional functions in Microsoft Azure.
Documentation
Microsoft.ContainerRegistry/registries - Bicep, ARM template & Terraform AzAPI reference
Azure Microsoft.ContainerRegistry/registries syntax and properties to use in Azure Resource Manager templates for deploying the resource. API version latest
Microsoft.ContainerRegistry/registries/tasks - Bicep, ARM template & Terraform AzAPI reference
Azure Microsoft.ContainerRegistry/registries/tasks syntax and properties to use in Azure Resource Manager templates for deploying the resource. API version latest
Quickstart: Create an Azure container registry using Terraform - Azure Container Registry
In this quickstart, you create a unique resource group and an Azure container registry in a specified location using Terraform.