[BUG] Can not get secret from KeyVault on account of failing ManagedIdentityCredential GetToken method in Gov and China clouds #34077
Labels
Azure.Identity
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Library name and version
Azure.Identity 1.8.2, Azure.Security.KeyVault.Secrets 4.4.0
Describe the bug
Hello, we are running into a scenario in the non-public clouds (reproduced in both UsGov and ChinaCloud) in which we are initializing a
ManagedIdentityCredential
, and using the resulting credential to initialize a secret client which we then use to obtain a secret from KeyVault. Unfortunately our call toGetSecret
results in this error:We have the AuthorityHost set correctly and the managed identity is created in the correct cloud.
Through some manual testing I've found that if we initialize as a
DefaultAzureCredential
and pass in a managed identity client id the secrets library is able to successfully callGetToken
on theDefaultAzureCredential
which in turn successfully callsManagedIdentityCredential
's get token method! Here is some telemetry of one of our successful calls vs a failing call, notice that they are both in the end simply callingManagedIdentityCredential
'sGetToken
method.Thanks for taking a look, really appreciate any insight on this.
Expected behavior
In public cloud we are simply able to call
GetSecret
and the key vault returns our secret.Actual behavior
As mentioned above in non-public clouds we are unable to access key vault.
Reproduction Steps
I've managed to reproduce it with just this:
And here is the code that runs successfully after using a default azure credential:
Environment
Seen on both Azure App Service and Azure Service Fabric, both running Windows Server.
The text was updated successfully, but these errors were encountered: