-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBaseInfrastructure.ps1
45 lines (37 loc) · 1.62 KB
/
BaseInfrastructure.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$SolutionPrefix = "ttvdtrn"
$AzureSubscriptionName = "Microsoft Azure"
$ResourceGroupLocation = "westeurope"
$VpnGateway = "none"
<#
Attention: Provisioning a vpn gateway can take up to 20 minutes!
Available vpnGateway:
- none
- basic
- standard
- highperformace
#>
$TemplateParameters = @{
namePrefix = $SolutionPrefix
vpnGateway = $VpnGateway
}
$ResourceGroupName = ($SolutionPrefix + "resg001")
$TemplateFileUri = "https://raw.githubusercontent.com/TVDKoni/ARM-Base-Templates/master/BaseInfrastructure/baseInfrastructureDeployment.json"
Write-Host "Login to azure account"
Login-AzureRmAccount
Write-Host "Selecting subscription '$($AzureSubscriptionName)'"
$subscription = Get-AzureRmSubscription –SubscriptionName $AzureSubscriptionName #add -TenantId if subscription name is not unique
Select-AzureRmSubscription -SubscriptionId $subscription.SubscriptionId | Out-String | Write-Verbose
Write-Host "Getting resource group '$($ResourceGroupName)'"
if (-not (Get-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -ErrorAction SilentlyContinue)) {
Write-Host "Resource group does not exists. Creating it."
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation | Out-String | Write-Verbose
}
Write-Host "Deploying template"
$deployment = New-AzureRmResourceGroupDeployment -ResourceGroupName $ResourceGroupName -TemplateUri $TemplateFileUri -TemplateParameterObject $TemplateParameters -Verbose
Write-Host "Template outputs:"
foreach($key in $deployment.Outputs.Keys)
{
Write-Host (" " + $key + ": " + $deployment.Outputs[$key].Value)
}
Write-Host "Done"
pause