ACR Image Import

April 3, 2024 · View on GitHub

⚠️ Retired ⚠️

This module has been retired without a replacement module in Azure Verified Modules (AVM).

For more information, see the informational notice here.

ACR Image Import

An Azure CLI Deployment Script that imports public container images to an Azure Container Registry

Details

An Azure CLI Deployment Script that imports public container images to an Azure Container Registry.

Parameters

NameTypeRequiredDescription
acrNamestringYesThe name of the Azure Container Registry
locationstringNoThe location to deploy the resources to
forceUpdateTagstringNoHow the deployment script should be forced to execute
rbacRoleNeededstringNoAzure RoleId that are required for the DeploymentScript resource to import images
useExistingManagedIdentityboolNoDoes the Managed Identity already exists, or should be created
managedIdentityNamestringNoName of the Managed Identity resource
existingManagedIdentitySubIdstringNoFor an existing Managed Identity, the Subscription Id it is located in
existingManagedIdentityResourceGroupNamestringNoFor an existing Managed Identity, the Resource Group it is located in
imagesarrayYesAn array of fully qualified images names to import
initialScriptDelaystringNoA delay before the script import operation starts. Primarily to allow Azure AAD Role Assignments to propagate
cleanupPreferencestringNoWhen the script resource is cleaned up

Outputs

NameTypeDescription
importedImagesarrayAn array of the imported images

Examples

Importing a single image

param location string = resourceGroup().location
param acrName string =  'yourAzureContainerRegistry'

var imageName = 'mcr.microsoft.com/azuredocs/azure-vote-front:v1'

module acrImport 'br/public:deployment-scripts/import-acr:3.0.2' = {
  name: 'testAcrImportSingle'
  params: {
    acrName: acrName
    location: location
    images: array(imageName)
  }
}

Importing multiple images

param location string = resourceGroup().location
param acrName string =  'yourAzureContainerRegistry'

var imageNames = [
  'docker.io/bitnami/external-dns:latest'
  'quay.io/jetstack/cert-manager-cainjector:v1.7.2'
  'docker.io/bitnami/redis:latest'
]

module acrImport 'br/public:deployment-scripts/import-acr:3.0.2' = {
  name: 'testAcrImportMulti'
  params: {
    acrName: acrName
    location: location
    images: imageNames
  }
}

Using an existing managed identity

param location string = resourceGroup().location
param acrName string =  'yourAzureContainerRegistry'
param existingManagedIdName = 'yourExistingManagedIdentity'

module acrImport 'br/public:deployment-scripts/import-acr:3.0.2' = {
  name: 'testAcrImport'
  params: {
    useExistingManagedIdentity: true
    managedIdentityName: existingManagedIdName
    existingManagedIdentityResourceGroupName: resourceGroup().name
    existingManagedIdentitySubId: subscription().subscriptionId
    rbacRoleNeeded = '' //If the existing ManagedId already has RBAC, we can opt out of the RBAC assignment
    acrName: acr.name
    location: location
    images: array('mcr.microsoft.com/azuredocs/azure-vote-front:v1')
  }
}

Using an longer script delay

param location string = resourceGroup().location
param acrName string =  'yourAzureContainerRegistry'

module acrImport 'br/public:deployment-scripts/import-acr:3.0.2' = {
  name: 'testAcrImport'
  params: {
    initialScriptDelay: '60s'
    acrName: acr.name
    location: location
    images: array('mcr.microsoft.com/azuredocs/azure-vote-front:v1')
  }
}