azureazure-cliazure-container-appsdefaultazurecredential

How to update ACR password in the Azure container app secrets without using UI?


As we have more than 50 container apps that require ACR password updates, doing it through UI is a very long task.

I tried to create a Makefile which uses the az cli tool to get the secret name and update with new password. Note, the secret name was auto-created when container app is created.

While running the below command,

az containerapp secret set -n MyApp -g MyRG --secrets reg-pswd-abcd1234-ab12=MySecretToken where reg-pswd-abcd1234-ab12 is the name of the secret automatically generated upon the app's creation

getting the following error:

Secret names cannot be longer than 20. Please shorten reg-pswd-abcd1234-ab12

Question:

  1. Is there any other workaround to update this secret value?

or

  1. Create a new secret value and replace the reference of the old secret name with a newer one?

Solution

  • This length limit was a bug in the azure-cli tool. This tool is hosted on GitHub, so I filed an issue on it which is now resolved. Kudos to that team for the quick turnaround. In the short term, see the end of that issue for a local workaround involving a one-line local edit to the azure-cli Python code to remove the length restriction.

    Better still, the fix has been merged and should be in the release after 2.61.0.