Skip to content

Error from Container Apps- Failed to connect to MSI. Please make sure MSI is configured correctly. #22677

Description

az feedback auto-generates most of the information requested below, as of CLI version 2.37.0

Related command

az login --identity

Describe the bug

Running azure-cli in ContainerApps with MSI, both System assigned and User assigned, but az login --identity failed with 405.

Failed to connect to MSI. Please make sure MSI is configured correctly.
Get Token request returned: <Response [405]>

To Reproduce

  1. Prepare ResourceGroup foo.
  2. Prepare ContainerApps Environment bar.
  3. Save YAML as follows, please replace xxxx with your subscription id.
kind: containerapp
location: japaneast
name: azure-cli
resourceGroup: foo
type: Microsoft.App/containerApps
identity:
  type: "systemAssigned"
properties:
  managedEnvironmentId: "/subscriptions/xxxx/resourceGroups/foo/providers/Microsoft.App/managedEnvironments/bar"
  configuration:
    activeRevisionsMode: Single
  template:
    containers:
      - image: "mcr.microsoft.com/azure-cli"
        name: azure-cli
        command:
          ["/bin/bash", "-c", "while true; do ping localhost; sleep 60;done"]
        resources:
          cpu: 0.25
          memory: 0.5Gi
    scale:
      minReplicas: 1
      maxReplicas: 1
  1. Deploy Container App.
az containerapp create -n "azure-cli" -g "foo" --yaml ./deploy/containerapp/azure-cli.yaml
  1. (optional) Assign UserAssignedIdentity if needed.
az containerapp identity assign --name "azure-cli" --resource-group "foo" --user-assigned "/subscriptions/xxxxx/resourceGroups/foo/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<YOUR_ID>"
  1. Go to console in Container App side Menu.
  2. Run az login --identity. You will find error message describe about.

Expected behavior

Managed Identity can be use for az login as describe in doc.

Managed identities in Azure Container Apps | Microsoft Docs

Environment summary

Docker

Additional context

# az --version
azure-cli                         2.37.0

core                              2.37.0
telemetry                          1.0.6

Dependencies:
msal                            1.18.0b1
azure-mgmt-resource             21.1.0b1

Python location '/usr/local/bin/python'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.10.4 (main, Apr 20 2022, 01:09:52) [GCC 10.3.1 20211027]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions