forked from fabferri/az-pattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipv6.ps1
46 lines (40 loc) · 1.7 KB
/
ipv6.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
46
# Powershell script to deploy a configuration with hub-spoke VNet
# the full configuration is described in the ARM template "ipv6.json"
#
#
# Note:
# Before running the script, set properly the value of following variables:
# 1. $adminUsername
# 2. $adminPassword
# 3. $subscriptionName: Azure subscription name
# 4. $location: name of Azure region where is stored the deployed configuration
#
[CmdletBinding()]
param (
[Parameter( Mandatory = $false, ValueFromPipeline=$false, HelpMessage='username administrator VMs')]
[string]$adminUsername = "ADMIN_USERUSERNAME",
[Parameter(Mandatory = $false, HelpMessage='password administrator VMs')]
[string]$adminPassword = "ADMIN_PASSWORD"
)
################# Input parameters #################
$subscriptionName = "AzureDemo3"
$location = "northeurope"
$rgName = "ipv6-1"
$rgDeployment = "ipv6-depl"
$armTemplateFile = "ipv6.json"
####################################################
$pathFiles = Split-Path -Parent $PSCommandPath
$templateFile = "$pathFiles\$armTemplateFile"
$templateParamsFile = "$pathFiles\$armParameterFile"
$parameters=@{
"adminUsername"= $adminUsername;
"adminPassword"= $adminPassword
}
$subscr=Get-AzSubscription -SubscriptionName $subscriptionName
Select-AzSubscription -SubscriptionId $subscr.Id
$runTime=Measure-Command {
New-AzResourceGroup -Name $rgName -Location $location
write-host $templateFile
New-AzResourceGroupDeployment -Name $rgDeployment -ResourceGroupName $rgName -TemplateFile $templateFile -TemplateParameterObject $parameters -Verbose
}
write-host -ForegroundColor Yellow "runtime: "$runTime.ToString()