Example of how to access secrets from azure KeyVault inside azure pipelines.
- https://learn.microsoft.com/en-us/azure/devops/pipelines/release/azure-key-vault?view=azure-devops&tabs=yaml
- Microsoft Azure Developer: Implement Secure Cloud Solutions
- Designing a Sensitive Information Strategy
-
Create resource group
$rgName="rg-keyvault-demo"
$location="westus"
az group create -n $rgName -l $location
-
Create KeyVault
$kvName="pkolosovkv-$(Get-Random 1000)"
az keyvault create -n $kvName -l $location -g $rgName
-
Create secrets
az keyvault secret set --name "Password1" --value "mysecretpassword1" --vault-name $kvName
az keyvault secret set --name "Password2" --value "mysecretpassword2" --vault-name $kvName
-
Create app service plan
$planName="kvappserviceplan"
az appservice plan create -g $rgName -n $planName --sku "F1"
-
Create app service
$appName="kvmvcappservice"
$runtime="dotnet:6"
az webapp create -g $rgName -n $appName --plan $planName --runtime $runtime
- See folder:
enable_managed_identity
Azure.Identity
Azure.Security.KeyVault.Secrets
- KeyVault References
Syntax:
@Microsoft.KeyVault(SecretUri=https://pkolosovkv-690.vault.azure.net/secrets/secretValue/1e93930da05b46029c342c5ebe194445)