Skip to content

Instantly share code, notes, and snippets.


Muhammad Faizan-ul-haq faizan002

View GitHub Profile
faizan002 / create_vault.ps1
Created Nov 13, 2017
Create a Vault In Azure to store password and retrieve it to use in Credentials object. (Powershell Azure automation)
View create_vault.ps1
$password="super secret value"
$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
faizan002 / NumberOfRG.ps1
Last active Nov 13, 2017
Calculate number of ResourceGroups with same prefix string in name. (Microsoft Azure - Powershell)
View NumberOfRG.ps1
$existingNumberOfRGs = $(Get-AzureRmResourceGroup | Where-Object {$_.ResourceGroupName -like "$vmNamePrefix*"}).count
$nextRGNumber = $existingNumberOfRGs + 1
$rgName = $rgNamePrefix + "$nextRGNumber"