Imran Ahmad Shahid
Imran Ahmad Shahid

Reputation: 822

Bicep modules files are not getting updated in container registry

I have created the container registry in order to upload the bicep modules and the use those in multiple places. I have uploaded the files and it's working fine but now I needed to change the bicep files in the default version and I am trying to do that using following command, I can see the increment in Manifest count on the azure portal > Container Registry > Repositories > MyFile

az bicep publish -f "myfile.bicep" --target "br:myregistry.azurecr.io/folder/myfile:default" --force

I am even using --force tag to update the content but it's not working.

Upvotes: 0

Views: 131

Answers (1)

Arko
Arko

Reputation: 3731

As Thomas rightly pointed out, the --force parameter should not be placed within quotes in the command. According to the documentation, the correct syntax should keep --force as a standalone parameter.

For example, if you have a bicep file named myfile.bicep

resource  storageAccount  'Microsoft.Storage/storageAccounts@2022-09-01' = {
  name: 'mystorage${uniqueString(resourceGroup().id)}'  
  location: resourceGroup().location  
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2'
}

output  storageAccountName  string = storageAccount.name

which you have uploaded to your acr

enter image description here

and now you want to update the bicep module and republish. For example, update the SKU

resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
  name: 'st${uniqueString(resourceGroup().id)}'  // Shortened prefix to "st"
  location: resourceGroup().location
  sku: {
    name: 'Standard_GRS'  // Updated SKU
  }
  kind: 'StorageV2'
}

output storageAccountName string = storageAccount.name

Run the az bicep publish command again with the --force option to overwrite the previous version

az bicep publish -f "./myfile.bicep" --target "br:arkoacr.azurecr.io/folder/myfile:default" --force

without force

enter image description here

with --force

enter image description here

Now check in your acr-

earlier

enter image description here

now

enter image description here

Reference-

az bicep | Microsoft Learn

Upvotes: 1

Related Questions