3838 pwsh : true
3939 ScriptType : ' InlineScript'
4040 Inline : |
41- $deploymentType = "${{ parameters.deploymentType }}"
42- $whatIfEnabled = [System.Convert]::ToBoolean("${{ parameters.whatIfEnabled }}")
41+ $deploymentType = "$$ {{ parameters.deploymentType }}"
42+ $whatIfEnabled = [System.Convert]::ToBoolean("$$ {{ parameters.whatIfEnabled }}")
4343
4444 # Check if we should skip what-if for first deployment
4545 $firstDeploymentString = $env:FIRST_DEPLOYMENT
5050 $firstDeployment = [System.Convert]::ToBoolean($firstDeploymentString)
5151 }
5252
53- $firstRunWhatIf = [System.Convert]::ToBoolean("${{ parameters.firstRunWhatIf }}")
53+ $firstRunWhatIf = [System.Convert]::ToBoolean("$$ {{ parameters.firstRunWhatIf }}")
5454
5555 if($whatIfEnabled -and $firstDeployment -and !$firstRunWhatIf) {
5656 Write-Warning "Skipping the What-If check as the deployment is dependent on resources that do not exist yet..."
7171 # Generate deployment name without timestamp for consistent deployment stack names
7272 $deploymentPrefix = "alz"
7373
74- $deploymentNameBase = "${{ parameters.displayName }}".Replace(" ", "-")
74+ $deploymentNameBase = "$$ {{ parameters.displayName }}".Replace(" ", "-")
7575 $deploymentNameBase = "$deploymentNameBase-$($env:TIME_STAMP)"
7676
7777 $deploymentNameMaxLength = 64 - $deploymentPrefix.Length - 1
@@ -88,30 +88,30 @@ steps:
8888 Write-Host "Starting $modeText for $deploymentName" -ForegroundColor Blue
8989 Write-Host "================================================" -ForegroundColor Blue
9090 Write-Host ""
91- Write-Host "Display Name: ${{ parameters.displayName }}" -ForegroundColor DarkGray
91+ Write-Host "Display Name: $$ {{ parameters.displayName }}" -ForegroundColor DarkGray
9292 Write-Host "Deployment Name: $deploymentName" -ForegroundColor DarkGray
93- Write-Host "Template File Path: ${{ parameters.templateFilePath }}" -ForegroundColor DarkGray
94- Write-Host "Template Parameters File Path: ${{ parameters.templateParametersFilePath }}" -ForegroundColor DarkGray
95- Write-Host "Management Group Id: ${{ parameters.managementGroupId }}" -ForegroundColor DarkGray
96- Write-Host "Subscription Id: ${{ parameters.subscriptionId }}" -ForegroundColor DarkGray
97- Write-Host "Resource Group Name: ${{ parameters.resourceGroupName }}" -ForegroundColor DarkGray
98- Write-Host "Location: ${{ parameters.location }}" -ForegroundColor DarkGray
93+ Write-Host "Template File Path: $$ {{ parameters.templateFilePath }}" -ForegroundColor DarkGray
94+ Write-Host "Template Parameters File Path: $$ {{ parameters.templateParametersFilePath }}" -ForegroundColor DarkGray
95+ Write-Host "Management Group Id: $$ {{ parameters.managementGroupId }}" -ForegroundColor DarkGray
96+ Write-Host "Subscription Id: $$ {{ parameters.subscriptionId }}" -ForegroundColor DarkGray
97+ Write-Host "Resource Group Name: $$ {{ parameters.resourceGroupName }}" -ForegroundColor DarkGray
98+ Write-Host "Location: $$ {{ parameters.location }}" -ForegroundColor DarkGray
9999 Write-Host "Deployment Type: $deploymentType" -ForegroundColor DarkGray
100100 Write-Host "What-If Mode: $whatIfEnabled" -ForegroundColor DarkGray
101101 Write-Host ""
102102
103103 # Check if template files exist
104- if (-not (Test-Path "${{ parameters.templateFilePath }}")) {
105- Write-Error "Template file not found: ${{ parameters.templateFilePath }}"
106- throw "Template file not found: ${{ parameters.templateFilePath }}"
104+ if (-not (Test-Path "$$ {{ parameters.templateFilePath }}")) {
105+ Write-Error "Template file not found: $$ {{ parameters.templateFilePath }}"
106+ throw "Template file not found: $$ {{ parameters.templateFilePath }}"
107107 }
108- Write-Host "✓ Template file exists: ${{ parameters.templateFilePath }}" -ForegroundColor Green
108+ Write-Host "✓ Template file exists: $$ {{ parameters.templateFilePath }}" -ForegroundColor Green
109109
110- if (-not (Test-Path "${{ parameters.templateParametersFilePath }}")) {
111- Write-Error "Template parameters file not found: ${{ parameters.templateParametersFilePath }}"
112- throw "Template parameters file not found: ${{ parameters.templateParametersFilePath }}"
110+ if (-not (Test-Path "$$ {{ parameters.templateParametersFilePath }}")) {
111+ Write-Error "Template parameters file not found: $$ {{ parameters.templateParametersFilePath }}"
112+ throw "Template parameters file not found: $$ {{ parameters.templateParametersFilePath }}"
113113 }
114- Write-Host "✓ Template parameters file exists: ${{ parameters.templateParametersFilePath }}" -ForegroundColor Green
114+ Write-Host "✓ Template parameters file exists: $$ {{ parameters.templateParametersFilePath }}" -ForegroundColor Green
115115 Write-Host ""
116116
117117 if ($whatIfEnabled) {
@@ -121,8 +121,8 @@ steps:
121121
122122 $whatIfParameters = @{
123123 DeploymentName = $deploymentName
124- TemplateFile = "${{ parameters.templateFilePath }}"
125- TemplateParameterFile = "${{ parameters.templateParametersFilePath }}"
124+ TemplateFile = "$$ {{ parameters.templateFilePath }}"
125+ TemplateParameterFile = "$$ {{ parameters.templateParametersFilePath }}"
126126 WhatIf = $true
127127 ValidationLevel = "providerNoRbac"
128128 Verbose = $true
@@ -131,34 +131,34 @@ steps:
131131 try {
132132 switch ($deploymentType) {
133133 "managementGroup" {
134- $targetManagementGroupId = "${{ parameters.managementGroupId }}"
134+ $targetManagementGroupId = "$$ {{ parameters.managementGroupId }}"
135135 if ([string]::IsNullOrWhiteSpace($targetManagementGroupId)) {
136136 $targetManagementGroupId = (Get-AzContext).Tenant.TenantId
137137 }
138138
139139 Write-Host "Running Management Group What-If: $deploymentName" -ForegroundColor Cyan
140- $whatIfParameters.Location = "${{ parameters.location }}"
140+ $whatIfParameters.Location = "$$ {{ parameters.location }}"
141141 $whatIfParameters.ManagementGroupId = $targetManagementGroupId
142142 $result = New-AzManagementGroupDeployment @whatIfParameters
143143 }
144144 "subscription" {
145- if (-not [string]::IsNullOrWhiteSpace("${{ parameters.subscriptionId }}")) {
146- Write-Host "Setting subscription context to: ${{ parameters.subscriptionId }}" -ForegroundColor Cyan
147- Select-AzSubscription -SubscriptionId "${{ parameters.subscriptionId }}" | Out-Null
145+ if (-not [string]::IsNullOrWhiteSpace("$$ {{ parameters.subscriptionId }}")) {
146+ Write-Host "Setting subscription context to: $$ {{ parameters.subscriptionId }}" -ForegroundColor Cyan
147+ Select-AzSubscription -SubscriptionId "$$ {{ parameters.subscriptionId }}" | Out-Null
148148 }
149149
150150 Write-Host "Running Subscription What-If: $deploymentName" -ForegroundColor Cyan
151- $whatIfParameters.Location = "${{ parameters.location }}"
151+ $whatIfParameters.Location = "$$ {{ parameters.location }}"
152152 $result = New-AzSubscriptionDeployment @whatIfParameters
153153 }
154154 "resourceGroup" {
155- if (-not [string]::IsNullOrWhiteSpace("${{ parameters.subscriptionId }}")) {
156- Write-Host "Setting subscription context to: ${{ parameters.subscriptionId }}" -ForegroundColor Cyan
157- Select-AzSubscription -SubscriptionId "${{ parameters.subscriptionId }}" | Out-Null
155+ if (-not [string]::IsNullOrWhiteSpace("$$ {{ parameters.subscriptionId }}")) {
156+ Write-Host "Setting subscription context to: $$ {{ parameters.subscriptionId }}" -ForegroundColor Cyan
157+ Select-AzSubscription -SubscriptionId "$$ {{ parameters.subscriptionId }}" | Out-Null
158158 }
159159
160160 Write-Host "Running Resource Group What-If: $deploymentName" -ForegroundColor Cyan
161- $whatIfParameters.ResourceGroupName = "${{ parameters.resourceGroupName }}"
161+ $whatIfParameters.ResourceGroupName = "$$ {{ parameters.resourceGroupName }}"
162162 $result = New-AzResourceGroupDeployment @whatIfParameters
163163 }
164164 default {
@@ -181,8 +181,8 @@ steps:
181181 # Deployment Stack mode - actual deployment
182182 $stackParameters = @{
183183 Name = $deploymentName
184- TemplateFile = "${{ parameters.templateFilePath }}"
185- TemplateParameterFile = "${{ parameters.templateParametersFilePath }}"
184+ TemplateFile = "$$ {{ parameters.templateFilePath }}"
185+ TemplateParameterFile = "$$ {{ parameters.templateParametersFilePath }}"
186186 DenySettingsMode = "None"
187187 ActionOnUnmanage = "DeleteAll"
188188 Force = $true
@@ -194,7 +194,7 @@ steps:
194194 try {
195195 switch ($deploymentType) {
196196 "managementGroup" {
197- $targetManagementGroupId = "${{ parameters.managementGroupId }}"
197+ $targetManagementGroupId = "$$ {{ parameters.managementGroupId }}"
198198 if ([string]::IsNullOrWhiteSpace($targetManagementGroupId)) {
199199 $targetManagementGroupId = (Get-AzContext).Tenant.TenantId
200200 }
@@ -222,25 +222,25 @@ steps:
222222 }
223223
224224 Write-Host "Creating Management Group Deployment Stack: $deploymentName" -ForegroundColor Cyan
225- $result = New-AzManagementGroupDeploymentStack @stackParameters -ManagementGroupId $targetManagementGroupId -Location "${{ parameters.location }}"
225+ $result = New-AzManagementGroupDeploymentStack @stackParameters -ManagementGroupId $targetManagementGroupId -Location "$$ {{ parameters.location }}"
226226 }
227227 "subscription" {
228- if (-not [string]::IsNullOrWhiteSpace("${{ parameters.subscriptionId }}")) {
229- Write-Host "Setting subscription context to: ${{ parameters.subscriptionId }}" -ForegroundColor Cyan
230- Select-AzSubscription -SubscriptionId "${{ parameters.subscriptionId }}" | Out-Null
228+ if (-not [string]::IsNullOrWhiteSpace("$$ {{ parameters.subscriptionId }}")) {
229+ Write-Host "Setting subscription context to: $$ {{ parameters.subscriptionId }}" -ForegroundColor Cyan
230+ Select-AzSubscription -SubscriptionId "$$ {{ parameters.subscriptionId }}" | Out-Null
231231 }
232232
233233 Write-Host "Creating Subscription Deployment Stack: $deploymentName" -ForegroundColor Cyan
234- $result = New-AzSubscriptionDeploymentStack @stackParameters -Location "${{ parameters.location }}"
234+ $result = New-AzSubscriptionDeploymentStack @stackParameters -Location "$$ {{ parameters.location }}"
235235 }
236236 "resourceGroup" {
237- if (-not [string]::IsNullOrWhiteSpace("${{ parameters.subscriptionId }}")) {
238- Write-Host "Setting subscription context to: ${{ parameters.subscriptionId }}" -ForegroundColor Cyan
239- Select-AzSubscription -SubscriptionId "${{ parameters.subscriptionId }}" | Out-Null
237+ if (-not [string]::IsNullOrWhiteSpace("$$ {{ parameters.subscriptionId }}")) {
238+ Write-Host "Setting subscription context to: $$ {{ parameters.subscriptionId }}" -ForegroundColor Cyan
239+ Select-AzSubscription -SubscriptionId "$$ {{ parameters.subscriptionId }}" | Out-Null
240240 }
241241
242242 Write-Host "Creating Resource Group Deployment Stack: $deploymentName" -ForegroundColor Cyan
243- $result = New-AzResourceGroupDeploymentStack @stackParameters -ResourceGroupName "${{ parameters.resourceGroupName }}"
243+ $result = New-AzResourceGroupDeploymentStack @stackParameters -ResourceGroupName "$$ {{ parameters.resourceGroupName }}"
244244 }
245245 default {
246246 Write-Error "Invalid deployment type: $deploymentType"
0 commit comments