Skip to content

Instantly share code, notes, and snippets.

@asadrefai
Last active July 7, 2021 13:49
Show Gist options
  • Save asadrefai/bc04025928b843dfd034f40b05772461 to your computer and use it in GitHub Desktop.
Save asadrefai/bc04025928b843dfd034f40b05772461 to your computer and use it in GitHub Desktop.
Snippet for getting secret value from Azure Key Vault
const string secretName = "TestName";
var keyVaultName = "test-blog-kv";
var kvUri = $"https://{keyVaultName}.vault.azure.net";
var client = new SecretClient(new Uri(kvUri), new DefaultAzureCredential());
var secret = await client.GetSecretAsync(secretName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment