question

RakeshYadav-3862 avatar image
0 Votes"
RakeshYadav-3862 asked JamesTran-MSFT answered

not able to access key vault

Why I am not able to read the keyvault through the .net application though
through Azure CLI command or powershell able to access the keyvault secret ?

azure-key-vault
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What's the error message?

0 Votes 0 ·

I get below error
"ManagedIdentityCredential authentication failed: Retry failed after 4 tries"

My UK dev team memebers have no issue with it, they are able to access it. Problem is with Mumbai dev team

0 Votes 0 ·
Sam-Cogan avatar image
0 Votes"
Sam-Cogan answered RakeshYadav-3862 commented

Based on your error, you are using Managed Identity to access Key Vault. You need to make sure that the managed identity has been granted access to the Key Vault using either the access policies, or if you have updated your Key Vault to use Azure RBAC, the RBAC permissions.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Access policies seems ok to me as others are able to access same keyvault

0 Votes 0 ·


I ensured that I am member of key vault, problem occurs when I Call Key Vault to get a secret below is examle of code

var client = new SecretClient(new Uri("https://testkeyvault0208.vault.azure.net/"), new DefaultAzureCredential());
KeyVaultSecret secret = client.GetSecret(keyName);

0 Votes 0 ·
JamesTran-MSFT avatar image
0 Votes"
JamesTran-MSFT answered

@RakeshYadav-3862
Thank you for your post and I apologize for the delayed response!

Based off your error message - "ManagedIdentityCredential authentication failed: Retry failed after 4 tries", I was able to find a similar issue on Stack Overflow that might help with troubleshooting this. If you're trying to use ManagedIdentityCredential on your local machine, this isn't supported.


For more details:
When using DefaultAzureCredential, web app tries to use ManagedIdentityCredential on local computer
Local development authentication
AppAuthentication to Azure.Identity Migration Guidance
DefaultAzureCredential.cs



If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.


Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.