Created
February 22, 2016 21:40
-
-
Save bmoore-msft/710284c0bd791a688e21 to your computer and use it in GitHub Desktop.
Create an Azure KeyVault Enabled for Template Deployment (sh and ps)
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
#!/bin/bash -e | |
# A script to create an Azure KeyVault enabled for template deployment | |
#Change the values below before running the script | |
vaultName="myvault" #Globally Unique Name of the KeyVault | |
vaultLocation="East US" #Location of the KeyVault | |
resourceGroupName="vaults" #Name of the resource group for the vault | |
resourceGroupLocation="East US" #Location of the resource group if it needs to be created | |
#Login and Select the default subscription if needed | |
#azure login | |
#azure account set "subscription name" | |
azure config mode arm | |
azure group create "$resourceGroupName" "$resourceGroupLocation" | |
azure keyvault create --vault-name "$vaultName" --resource-group "$resourceGroupName" --location "$vaultLocation" | |
azure keyvault set-policy "$vaultName" --enabled-for-template-deployment true |
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
#Requires -Module AzureRM.Profile | |
#Requires -Module AzureRM.KeyVault | |
#Login and Select the default subscription if needed | |
#Login-AzureRmAccount | |
#Select-AzureRmSubscription -SubscriptionName 'subscription name' | |
#Change the values below before running the script | |
$VaultName = 'myvault' #Globally Unique Name of the KeyVault | |
$VaultLocation = 'East US' #Location of the KeyVault | |
$ResourceGroupName = 'vaults' #Name of the resource group for the vault | |
$ResourceGroupLocation = 'East US' #Location of the resource group if it needs to be created | |
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Force | |
New-AzureRmKeyVault -VaultName $VaultName -ResourceGroupName $ResourceGroupName -Location $VaultLocation -EnabledForTemplateDeployment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mykeyvoult