-
-
Save bachoang/f712488ddd72ab9eed7c6b0e2115ce61 to your computer and use it in GitHub Desktop.
Powershell to create Azure Key Vault
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
Connect-AzureRmAccount | |
$RGName = "BlogKVRG" | |
$location = "East US" | |
$KVName = "BlogKV123" | |
# Create a new Resource Group | |
New-AzureRmResourceGroup -Name $RGName -Location $location | |
# Create a new Azure Key Vault | |
New-AzureRmKeyVault -Name $KVName -ResourceGroupName $RGName -Location $location | |
# setting a new secret in the key vault | |
$secretvalue = ConvertTo-SecureString 'Pa$$w0rd' -AsPlainText -Force | |
$secret = Set-AzureKeyVaultSecret -VaultName $KVName -Name 'SQLPassword' -SecretValue $secretvalue | |
# get back the secret value | |
(get-azurekeyvaultsecret -vaultName $KVName -name "SQLPassword").SecretValueText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment