powershellacr

Migrate(copy) ACR with tag using Import-AzContainerRegistry


I am trying to import Azure container registry with tags.

I know the Azure cli command: az acr import --name $TARGET_REG --source $SOURCE_REG.azurecr.io/$repo":"$tag;

But Azure cli doesn't support in my work station and need to transform it into Power shell something like:

Import-AzContainerRegistryImage -RegistryName $TARGET_REG -ResourceGroupName $RG_NAME -SourceRegistryUri $SOURCE_REG_URI -SourceImage $tag

Any guidance over there?


Solution

  • After couple of trials and errors I am able to transform it with the below line of code that worked for me:

    Import-AzContainerRegistryImage -RegistryName $TARGET_REG -ResourceGroupName $TARGET_RG_NAME -SourceRegistryResourceId $SOURCE_REG_RES_ID -SourceImage $repo:$tag