services | platforms | author |
---|---|---|
key-vault |
dotnet |
lusitanian |
This sample repo demonstrates how to connect and authenticate to an Azure Key Vault vault. To do so, it first uses the Key Vault Management Client to create a vault. The Key Vault client is then used to authenticate to the vault and set/retrieve a sample secret.
-
If you don't already have it, get and install .NET
-
Clone the repo.
git clone https://github.com/Azure-Samples/key-vault-dotnet-authentication.git key-vault cd key-vault
-
Create an Azure service principal, using one of the following:
This service principal is to run the sample on your Azure account.
-
Set the following environment variables using the information from the service principal that you created.
export AZURE_SUBSCRIPTION_ID={your subscription id} export AZURE_CLIENT_ID={your client id} export AZURE_CLIENT_SECRET={your client secret} export AZURE_TENANT_ID={your tenant id as a GUID} export AZURE_CLIENT_OID={Object id of the service principal}
On Windows, use
set
instead ofexport
.
- Run the project with
dotnet run