azureazure-container-instances

Azure: Cannot deploy Logs Analytics


I deploy Container Instances to Azure and I want to troubleshoot why they die on me. I navigate to the logs and I get an error when I try to set up container instance logs: set up container instance logs

deployment failed

The password in the 'imageRegistryCredentials' of container group 'flaskhelloconfigurecontainer' cannot be empty.
 (Code: InvalidImageRegistryPassword)

loganalycs is a "Log Analytics workspace" resource. I deploy as:

az login
az  acr login --name slack # "slack" is my Resource group
docker build -t slack.azurecr.io/flaskhelloconfigure:v1 .
docker push slack.azurecr.io/flaskhelloconfigure:v1

Then I either deploy manually (I select a DNS) or do

az container create --resource-group slack --name flaskhelloconfigure --image slack.azurecr.io/flaskhelloconfigure  --ports 80 --dns-name-label "dnsflaskhelloconfigure" --registry-username=slack --registry-password="some/password/a"

where --registry-username and --registry-password are taken from these commands (source: ChatGPT when trying to solve the error above)

az acr update -n slack --admin-enabled true
az acr credential show --name slack

Solution

  • This looks as though the frontend is generating a deployment request with incorrect or missing properties, where the faulty piece of configuration is actually nothing to do with setting a log analytics export. The error message would imply that the registry credentials are incorrect in the deployment, so unfortunately (re)setting them with the command line won't help you.

    If you view the details of the failed deployment (the containerGroups resource in your screenshot), does this give you any indication of why it thinks the registry credentials are incorrect?

    This looks like a portal UI bug, but you might be able to work around this using the CLI to set the container group setting independently of the Azure Portal, something like:

    az resource update --ids $id --set properties.diagnostics.logAnalytics=@analyticsConfig.json where $id is the resource id of the container group, and @analyticsConfig.json is a JSON document you create containing the required properties for the diagnostics section:

    {
       "logType": "ContainerInstanceLogs",
       "workspaceId": "(your workspace id)",
       "workspaceKey": "(your workspace key)"
    }