[FEATURE REQ] DefaultAzureCredential for local docker testing

See original GitHub issue

Azure.Identity Testing code that uses DefaultAzureCredential in a container locally seems to require a lot of effort, unless one is willing to supply username/password into the environment. Creating a service principal and supplying the clientID + Secret is not much better, but also requires a whole lot of additional effort - like setting up the SP, granting the permissions that the developer account already has, etc.

There should be a way to use VS/VSCode/CLI tokens simply by mounting ~/.azure into /root/.azure of the container, unfortunately this does not work today. #12749 mentions installation of the CLI as a working solution, but I just tried this on Alpine and a) it’s a hassle - installing all that stuff on Alpine is error-prone experience and takes a long time (on each build!) b) it doesn’t work, as I still get the exception

SharedTokenCacheCredential authentication failed: Persistence check failed. Inspect inner exception for details —> Azure.Identity.AuthenticationFailedException: SharedTokenCacheCredential authentication failed: Persistence check failed. Inspect inner exception for details —> Microsoft.Identity.Client.Extensions.Msal.MsalCachePersistenceException: Persistence check failed. Inspect inner exception for details —> System.DllNotFoundException: Unable to load shared library ‘libsecret-1.so.0’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library liblibsecret-1.so.0: No such file or directory at Microsoft.Identity.Client.Extensions.Msal.Libsecret.secret_schema_new(String name, Int32 flags, String attribute1, Int32 attribute1Type, String attribute2, Int32 attribute2Type, IntPtr end) at Microsoft.Identity.Client.Extensions.Msal.LinuxKeyringAccessor.GetLibsecretSchema() at Microsoft.Identity.Client.Extensions.Msal.LinuxKeyringAccessor.Write(Byte[] data) at Microsoft.Identity.Client.Extensions.Msal.MsalCacheStorage.VerifyPersistence() — End of inner exception stack trace — at Microsoft.Identity.Client.Extensions.Msal.MsalCacheStorage.VerifyPersistence() at Microsoft.Identity.Client.Extensions.Msal.MsalCacheHelper.VerifyPersistence() at Azure.Identity.MsalClientBase1.GetClientAsync(Boolean async, CancellationToken cancellationToken) at Azure.Identity.MsalClientBase1.GetClientAsync(Boolean async, CancellationToken cancellationToken) at Azure.Identity.MsalPublicClient.GetAccountsAsync(Boolean async, CancellationToken cancellationToken) at Azure.Identity.SharedTokenCacheCredential.GetAccountAsync(Boolean async, CancellationToken cancellationToken) at Azure.Identity.SharedTokenCacheCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:38
  • Comments:74 (16 by maintainers)

github_iconTop GitHub Comments

32reactions
dmitriysecommented, May 15, 2022

Ideally such functionality should be inside Visual Studio out of the box.

  1. Docker containers development is a first-class feature of the Visual Studio
  2. Azure secret-less resource access is a first-class feature of the Azure SDK
  3. Azure connectivity from Visual-Studio again is a first class feature

Why developers should do the IDE enhancement job for the first class features to make them works together ?

Lack of support of zero secrets connectivity is appearing here and there. For example here there was also a problem https://github.com/dotnet/efcore/issues/26491

Please increase the priority of this feature request. It’s spanning a year already.

10reactions
nhart12commented, Jun 14, 2021

Agreed, to be able use/mount IDE azure credentials when local testing would be awesome. Azure CLI bloats images by almost a gig

Read more comments on GitHub >

github_iconTop Results From Across the Web

[FEATURE REQ] DefaultAzureCredential for local docker ...
This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer...
Read more >
Use DefaultAzureCredentials to authenticate Service bus ...
I created and pushed Docker container to ACR. When I run the container locally for testing outside of Azure, it does not know...
Read more >
Using Azure CLI Authentication within Local Containers
When testing your work in a local container you'll often need to authenticate with Azure resources, a Key Vault or Storage Account for ......
Read more >
Obtain Azure access token from a local Docker container
Identity library and it's DefaultAzureCredential type. This type will automatically try to obtain an Azure access token using various methods, ...
Read more >
Configure Visual Studio Container Tools
Configure the tools available in Visual Studio for working with Docker containers.
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