Last active
July 7, 2021 13:55
-
-
Save asadrefai/82f60fe172dda74e770ed4885cadd740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string secretName = "Test"; | |
var keyVaultName = "test-blog-kv"; | |
var kvUri = $"https://{keyVaultName}.vault.azure.net"; | |
// Creating an object and excluding methods which I do not want to be executed. Although these are executed in series, i.e. in my code, due to Enviornment Variables or Visual Studio exception was thrown. | |
// Ideally I would expect, if one method does not work, without breaking code it should move to another one. | |
DefaultAzureCredentialOptions options = new DefaultAzureCredentialOptions(); | |
options.ExcludeEnvironmentCredential = true; | |
options.ExcludeInteractiveBrowserCredential = true; | |
options.ExcludeManagedIdentityCredential = true; | |
options.ExcludeSharedTokenCacheCredential = true; | |
options.ExcludeVisualStudioCodeCredential = true; | |
options.ExcludeVisualStudioCredential = true; | |
var client = new SecretClient(new Uri(kvUri), new DefaultAzureCredential(options)); | |
var secret = await client.GetSecretAsync(secretName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment