This file contains hidden or 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
$password="super secret value" | |
$VaultName="SomeName" | |
$KeyName="KeyToStorePassword" | |
$ResourceGrpName="MyExistingResourceGroupName" | |
$loc="chose a valid value" | |
New-AzureRmKeyVault -VaultName $VaultName -ResourceGroupName $ResourceGrpName -Location $loc # (This creates a vault) | |
$PasswordAsSecureString = ConvertTo-SecureString -String $password -AsPlainText -Force | |
Set-AzureKeyVaultSecret -VaultName $VaultName -Name $KeyName -SecretValue $PasswordAsSecureString |
This file contains hidden or 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
$vmNamePrefix="SomeString" | |
$existingNumberOfRGs = $(Get-AzureRmResourceGroup | Where-Object {$_.ResourceGroupName -like "$vmNamePrefix*"}).count | |
$nextRGNumber = $existingNumberOfRGs + 1 | |
$rgName = $rgNamePrefix + "$nextRGNumber" |