In my current Net Core 3.1 WPF project I want the user to be able to connect to a Azure Key Vault. I have a key vault set up with some access policies set up or users.
In the documentation I read a lot about setting up connection to a key vault with environment variables using SecretClient(new Uri(_keyVaultUrl), new DefaultAzureCredential());
. What I don't understand is how environment variables can be of any use here, because they are limited to a single machine that has set them.
The above code returns a Null object error in my code:
Azure.Identity.CredentialUnavailableException: 'DefaultAzureCredential failed to retrieve a token from the included credentials.
- EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
- ManagedIdentityCredential authentication unavailable. The requested identity has not been assigned to this resource.
Status: 400 (Bad Request)
Is there a direct way where I can use a client-secret, app-id and then connect and authenticate with the azure key vault, using the Azure Identity library?