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.

AppAuthentication is not detecting MSI in a Windows container on Azure App Service

See original GitHub issue

Describe the bug I use the Microsoft.Azure.Services.AppAuthentication package to retrieve the access token of the MSI to authenticate with both Key Vault and other App Services. This works great for a ASP.NET Core 3.1 web app running in Linux container on an Azure App Service. The exact same code also works great for a ASP.NET Core 2.2 web app targeting the .NET Framework 4.8 and running on a normal Windows Azure App Service. The exact same code does NOT work for a ASP.NET Core 2.2 web app targeting the .NET Framework 4.8 and running in a Windows container on a Windows Azure App Service.

When running in a Windows container, the Microsoft.Azure.Services.AppAuthentication library does not seem to pickup the MSI credentials or detect the MSI for some reason. I’m wondering if this is expected to work or not and if anyone has actually tested this and can confirm if it works?

If I supply an AzureServicesAuthConnectionString environment variable it works fine and the Microsoft.Azure.Services.AppAuthentication library detects and uses the SP and credentials that are specified in the AzureServicesAuthConnectionString environment variable. But this is not meant to be used like this for production deployments. It should detect and use the MSI of the web app.

Expected behavior Microsoft.Azure.Services.AppAuthentication should work the same in a Windows container on an Azure App Service as it does for a Linux container on an Azure App Service and also a normal web app.

Actual behavior (include Exception or Stack Trace) Seems to ignore the MSI credentials. I am having a difficult time getting any logs out of the container regarding Microsoft.Azure.Services.AppAuthentication.

Environment Azure Windows container App Service with MSI enabled. ASP.NET Core 2.2 targeting the .NET Framework 4.8. Microsoft.Azure.Services.AppAuthentication v1.6.0.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jvanocommented, Dec 18, 2020

We have no plans to fix VNET_ROUTE_ALL=1 in the short term but I will make sure that if it is defined not to break existing functionality like MSI

0reactions
krispennercommented, Feb 23, 2022

Thanks @jvano. I have created a support request. Will close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure appservice for containers and managed service ...
It appears a question of a similar nature has already been answered: Azure App Service stops working after enabling Managed Identity.
Read more >
Unable to use MSI from within App Service Container
Your error states that you are using MSI endpoint for Virtual Machines. Use app service endpoint, it's available via IDENTITY_ENDPOINT ...
Read more >
Authenticate Python apps to Azure using the Azure SDK - ...
This article provides an overview of how to authenticate applications to Azure services when you use the Azure SDK for Python in both...
Read more >
Untitled
App Authentication client library for .NET - version 1.6.0 - Azure for Web24 Jun 2019 · [BUG] Microsoft.Azure.Services.AppAuthentication 1.2.0 breaks ...
Read more >
How to Secure Azure SQL Database with Managed Identity ...
Learn how to seamlessly and securely connect to a SQL database using Azure AD authentication.
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