@@ -257,7 +257,7 @@ function Test-NewResourceGroupDeploymentStack
257
257
258
258
<#
259
259
. SYNOPSIS
260
- Tests NEW and Set operation on deploymentStacks at the RG scope using template specs
260
+ Tests NEW and SET operation on deploymentStacks at the RG scope using template specs
261
261
#>
262
262
263
263
function Test-NewAndSetResourceGroupDeploymentStackWithTemplateSpec
@@ -297,6 +297,48 @@ function Test-NewAndSetResourceGroupDeploymentStackWithTemplateSpec
297
297
}
298
298
}
299
299
300
+ <#
301
+ . SYNOPSIS
302
+ Tests NEW and SET operation on deploymentStacks at the subscription scope using template specs
303
+ #>
304
+
305
+ function Test-NewAndSetSubscriptionDeploymentStackWithTemplateSpec
306
+ {
307
+ # Setup
308
+ $rgname = Get-ResourceGroupName
309
+ $rname = Get-ResourceName
310
+ $rglocation = " West US 2"
311
+
312
+ try {
313
+ # Prepare
314
+ New-AzResourceGroup - Name $rgname - Location $rglocation
315
+
316
+ $sampleTemplateJson = Get-Content - Raw - Path " subscription_level_template.json"
317
+ $basicCreatedTemplateSpec = New-AzTemplateSpec - ResourceGroupName $rgname - Name $rname - Location $rgLocation - Version " v1" - TemplateJson $sampleTemplateJson
318
+
319
+ $resourceId = $basicCreatedTemplateSpec.Id + " /versions/v1"
320
+
321
+ # Test - New-AzSubscriptionDeploymentStacks using templateSpecs
322
+ $deployment = New-AzResourceGroupDeploymentStacks - Name $rname - TemplateSpec $resourceId - ParameterFile " subscription_level_parameters.json"
323
+
324
+ # Assert
325
+ Assert-AreEqual Succeeded $deployment.ProvisioningState
326
+
327
+ # Test - Set-AzSubscriptionDeploymentStacks using templateSpecs
328
+ $deployment = Set-AzResourceGroupDeploymentStacks - Name $rname - TemplateSpec $resourceId - ParameterFile " sampleTemplateParams.json" - Location $rglocation - updateBehavior " detach"
329
+
330
+ # Assert
331
+ Assert-AreEqual Succeeded $deployment.ProvisioningState
332
+
333
+ }
334
+
335
+ finally
336
+ {
337
+ # Cleanup
338
+ Clean - ResourceGroup $rgname
339
+ }
340
+ }
341
+
300
342
301
343
<#
302
344
. SYNOPSIS
0 commit comments