question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kabal2010commented, Sep 28, 2022

I’m also facing this issue and wonder if there has been any resolution for it

2reactions
RakeshMohanMSFTcommented, Jun 1, 2022

@guitarrapc Thank you for reaching out, we are looking into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to connect to MSI. Please make sure MSI is configured ...
Failed to connect to MSI. Please make sure MSI is configured correctly. ... Connect to the container and attempt to authenticate with az...
Read more >
Container instances sporadically cannot connect to MSI ...
ERROR : MSI endpoint is not responding. Please make sure MSI is configured correctly.\nError detail: MSI: Failed to acquire tokens after 12 ...
Read more >
When I am running a deployment command on my pipeline us ...
While doing so I am doing it through Azure CLI (Inline command). 2022-11-17T08:27:29.5243851Z ERROR: Failed to connect to MSI. Please make sure ......
Read more >
Create a Kubernetes pod that uses Managed Service Identity ...
MIC uses the service principal credentials stored within the the AKS cluster to access azure resources. This service principal needs to have Microsoft....
Read more >
Troubleshooting and Support — Acrobat Desktop Windows ...
This error occurs because one of the product's subdirectories under Program Files does not have the correct group permissions. To fix the problem,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found