Skip to content

Instantly share code, notes, and snippets.

@aw230012
Last active January 3, 2018 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aw230012/1479d2bada575624f7acd508eb6e7967 to your computer and use it in GitHub Desktop.
Save aw230012/1479d2bada575624f7acd508eb6e7967 to your computer and use it in GitHub Desktop.
PowerShell Deploy script for Azure Recovery Services Vault, policy, and automated Pester test
$subscriptionId = '<your subscription id>'
$deployment = '<unique deployment name>'
$configurationFile = "$PSScriptRoot\\Data\\RecoveryVaultConfiguration.json"
$configurationData = (Get-Content $configurationFile -Raw | ConvertFrom-Json).ConfigurationItems
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId $subscriptionId
New-AzureRmResourceGroup -Name $configurationData.ResourceGroup.Name -Location $configurationData.Location.Name -Force
New-AzureRmResourceGroupDeployment -Name $deployment `
-ResourceGroupName $configurationData.ResourceGroup.Name `
-TemplateFile './azuredeploy.json' `
-TemplateParameterFile './azuredeploy.parameters.json'
Write-Host -ForegroundColor Cyan 'Begin automated testing with Pester...'
Invoke-Pester -Script '.\Tests\New-RecoveryVault.Tests.ps1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment