sign icon indicating copy to clipboard operation
sign copied to clipboard

"All Managed Identity sources are unavailable" error in version 0.9.1-beta.26330.1

Open timlajaunie opened this issue 5 months ago • 7 comments

Describe the bug Authentication error stating "All Managed Identity sources are unavailable" with the 0.9.1-beta.26330.1 version of the sign tool. Signing works fine with the previous beta release.

Repro steps Attempt to sign using -ase, -asa, and -ascp switches after signing in to Azure using az login.

Expected behavior The artifact to be signed.

Actual behavior Authentication error.

Additional context fail: Azure.Identity[10] False MSAL 4.84.2.0 MSAL.NetCore .NET 8.0.28 Microsoft Windows 10.0.26200 [2026-07-01 03:38:36Z - 88cb89e8-1955-4377-bc43-6457d4d1e572] Exception type: Microsoft.Identity.Client.MsalClientException , ErrorCode: managed_identity_all_sources_unavailable To see full exception details, enable PII Logging. See https://aka.ms/msal-net-logging at Microsoft.Identity.Client.ManagedIdentity.ManagedIdentityClient.GetOrSelectManagedIdentitySourceAsync(RequestContext requestContext, Boolean isMtlsPopRequested, CancellationToken cancellationToken) at Microsoft.Identity.Client.ManagedIdentity.ManagedIdentityClient.SendTokenRequestForManagedIdentityAsync(RequestContext requestContext, AcquireTokenForManagedIdentityParameters parameters, CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.ManagedIdentityAuthRequest.SendTokenRequestForManagedIdentityAsync(ILoggerAdapter logger, CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.ManagedIdentityAuthRequest.GetAccessTokenAsync(CancellationToken cancellationToken, ILoggerAdapter logger) at Microsoft.Identity.Client.Internal.Requests.ManagedIdentityAuthRequest.ExecuteAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass13_1.<b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock) at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)

fail: Sign.Core.ISigner[0] ManagedIdentityCredential authentication failed: All Managed Identity sources are unavailable. The Azure Instance Metadata Service (IMDS) that runs on VMs was not detected: IMDSv2: IMDSv2 probe failed. Exception: Retry failed after 5 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (The operation was canceled.). IMDSv1: IMDSv1 probe failed. Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80). See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot Azure.Identity.AuthenticationFailedException: ManagedIdentityCredential authentication failed: All Managed Identity sources are unavailable. The Azure Instance Metadata Service (IMDS) that runs on VMs was not detected: IMDSv2: IMDSv2 probe failed. Exception: Retry failed after 5 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (The operation was canceled.). IMDSv1: IMDSv1 probe failed. Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80). See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot ---> MSAL.NetCore.4.84.2.0.MsalClientException: ErrorCode: managed_identity_all_sources_unavailable Microsoft.Identity.Client.MsalClientException: All Managed Identity sources are unavailable. The Azure Instance Metadata Service (IMDS) that runs on VMs was not detected: IMDSv2: IMDSv2 probe failed. Exception: Retry failed after 5 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80)) (The operation was canceled.). IMDSv1: IMDSv1 probe failed. Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (169.254.169.254:80). at Microsoft.Identity.Client.ManagedIdentity.ManagedIdentityClient.GetOrSelectManagedIdentitySourceAsync(RequestContext requestContext, Boolean isMtlsPopRequested, CancellationToken cancellationToken) at Microsoft.Identity.Client.ManagedIdentity.ManagedIdentityClient.SendTokenRequestForManagedIdentityAsync(RequestContext requestContext, AcquireTokenForManagedIdentityParameters parameters, CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.ManagedIdentityAuthRequest.SendTokenRequestForManagedIdentityAsync(ILoggerAdapter logger, CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.ManagedIdentityAuthRequest.GetAccessTokenAsync(CancellationToken cancellationToken, ILoggerAdapter logger) at Microsoft.Identity.Client.Internal.Requests.ManagedIdentityAuthRequest.ExecuteAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass13_1.<b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func1 codeBlock) at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken) at Microsoft.Identity.Client.ApiConfig.Executors.ManagedIdentityExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters, AcquireTokenForManagedIdentityParameters managedIdentityParameters, CancellationToken cancellationToken) at Azure.Identity.MsalManagedIdentityClient.AcquireTokenForManagedIdentityAsyncCore(Boolean async, TokenRequestContext requestContext, Boolean isTokenBindingAvailable, CancellationToken cancellationToken) at Azure.Identity.MsalManagedIdentityClient.AcquireTokenForManagedIdentityAsync(TokenRequestContext requestContext, Boolean isTokenBindingAvailable, CancellationToken cancellationToken) at Azure.Identity.ManagedIdentityClient.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken) at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken) --- End of inner exception stack trace --- at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage, Boolean isCredentialUnavailable) at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken) at Azure.Identity.ManagedIdentityCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) at Azure.Identity.DefaultAzureCredential.GetTokenFromSourcesAsync(TokenCredential[] sources, TokenRequestContext requestContext, Boolean async, CancellationToken cancellationToken) at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken) at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage, Boolean isCredentialUnavailable) at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken) at Azure.Identity.DefaultAzureCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.SetResultOnTcsFromCredentialAsync(TokenRequestContext context, TaskCompletionSource1 targetTcs, Boolean async, CancellationToken cancellationToken) at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetAuthHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async) at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.TokenRequestState.GetCurrentHeaderValue(Boolean async, Boolean checkForCompletion, CancellationToken cancellationToken) at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetAuthHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async) at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AuthenticateAndAuthorizeRequestAsync(HttpMessage message, TokenRequestContext context) at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory1 pipeline, Boolean async) at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory1 pipeline, Boolean async) at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory1 pipeline, Boolean async) at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory1 pipeline, Boolean async) at Azure.CodeSigning.CertificateProfileRestClient.GetSignCertificateChainAsync(String codeSigningAccountName, String certificateProfileName, CancellationToken cancellationToken) at Azure.CodeSigning.CertificateProfileClient.GetSignCertificateChainAsync(String codeSigningAccountName, String certificateProfileName, CancellationToken cancellationToken) at Sign.SignatureProviders.ArtifactSigning.ArtifactSigningService.GetCertificateAsync(CancellationToken cancellationToken) in //src/Sign.SignatureProviders.ArtifactSigning/ArtifactSigningService.cs:line 65 at Sign.Core.Signer.SignAsync(IReadOnlyList`1 inputFiles, String outputFile, FileInfo fileList, Boolean recurseContainers, DirectoryInfo baseDirectory, String applicationName, String publisherName, String description, Uri descriptionUrl, Uri timestampUrl, Int32 maxConcurrency, HashAlgorithmName fileHashAlgorithm, HashAlgorithmName timestampHashAlgorithm) in //src/Sign.Core/Signer.cs:line 79

timlajaunie avatar Jul 01 '26 03:07 timlajaunie

This seems to be caused by the latest dependency updates: https://github.com/dotnet/sign/commit/89c2a5d4a051014c243779d174bc3bb1fca62d7d

Specifically, updating the Azure.Core reference from version 1.57 to 1.59: https://github.com/Azure/azure-sdk-for-net/issues/59961#issuecomment-4717990021

timlajaunie avatar Jul 06 '26 19:07 timlajaunie

Hi @timlajaunie, I had the same problem but solved it by specifying the -act parameter, e.g. -act azure-cli.

Managed Identity seems to be the default as it's built for pipeline.

Did this help you to resolve your problem?

trepeschr avatar Jul 16 '26 10:07 trepeschr

Hi @timlajaunie, I had the same problem but solved it by specifying the -act parameter, e.g. -act azure-cli.

Thank you! This fixed it for me.

mcattle avatar Jul 23 '26 21:07 mcattle

Hi @timlajaunie, I had the same problem but solved it by specifying the -act parameter, e.g. -act azure-cli.

Managed Identity seems to be the default as it's built for pipeline.

Did this help you to resolve your problem?

Thanks for the tip! We simply downgraded the version of the sign tool for now. We're waiting for a new official release based on the fixed dependencies before we update again. Forcing "-act" works great for limited scenarios, and our scripts need to work beyond those limits.

timlajaunie avatar Jul 24 '26 20:07 timlajaunie

@timlajaunie, please note that inconsistent machine configurations can lead to different behavior. Sign tool ships with an appsettings.json file that allows us to adjust Azure library log levels. One option is to remove the existing entries, so the Sign CLI logs all internal Azure warnings and errors, then compare logs across machines to identify why their behavior differs.

This issue appears to be environment-specific and outside the Sign CLI’s scope. Passing -act option would limit the CLI to a specific authentication strategy.

kartheekp-ms avatar Aug 05 '26 00:08 kartheekp-ms

According to https://github.com/Azure/azure-sdk-for-net/issues/60650, the Azure.Core dependency version 1.63.0 contains the fix needed to solve this issue. Has the sign CLI been updated to target this corrected dependency?

timlajaunie avatar Oct 06 '26 18:10 timlajaunie

We updated Azure.Core version to 1.63.0 in https://github.com/dotnet/sign/commit/f3cc758ffd4f5edccb567820606b17eea49745c0. It will be part of this month's release.

kartheekp-ms avatar Oct 14 '26 21:10 kartheekp-ms