I am trying from my local web api, to retrieve secret from KeyVault using Azure.Identity lib. but it throws Invalid Issuer. Giving below the code I am using
My current code
var client = new SecretClient(new Uri("key-vault-url"), new DefaultAzureCredential()); ==> line #1
var secret = client.GetSecret("DicomSecret").Value; ==> line #2
As soon as it parses line#2 it throws the below error.
What I have tried
- I have added my Azure credential in the KeyVault thru' Add Access Policy
- Tried using ManagedIdentityCredential instead of DefaultAzureCredential in line#1
- Also tried using VisualStudioCredential instead of DefaultAzureCredential in line#1
I also read that I can be using EnvironmentCredential for which I need to provide AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET but I am not exactly sure how to and what to include for this - I do not have access to AAD.
Please let me know how to resolve this issue.