Created
February 28, 2021 19:14
-
-
Save billdeitrick/5e483d8304f7d0ba697851db9610bfeb to your computer and use it in GitHub Desktop.
Get Secret from Azure KeyVault Using Managed Identity - C#
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
using System; | |
using Azure.Security.KeyVault.Secrets; | |
using Azure.Identity; | |
namespace kvtest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var client = new SecretClient(new Uri("https://totallybogusvault.vault.azure.net"), new DefaultAzureCredential()); | |
var secret = client.GetSecret("totallybogussecret"); | |
Console.WriteLine($"The secret was \"{secret.Value.Value}\""); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment