From 2c82bf36044ab52f28b9cf7b54b5f315b0b7d460 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Wed, 11 Oct 2023 17:20:13 -0700 Subject: [PATCH 1/3] Remove ARM deployment after deploy --- eng/common/TestResources/New-TestResources.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index 49616b64b..5e10554bd 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -771,7 +771,7 @@ try { -TemplateParameterObject $templateFileParameters ` -Force:$Force } - + if ($deployment.ProvisioningState -ne 'Succeeded') { Write-Host "Deployment '$($deployment.DeploymentName)' has state '$($deployment.ProvisioningState)' with CorrelationId '$($deployment.CorrelationId)'. Exiting..." Write-Host @' @@ -803,6 +803,9 @@ try { Write-Verbose "Removing compiled bicep file $($templateFile.jsonFilePath)" Remove-Item $templateFile.jsonFilePath } + + Write-Host "Deleting ARM deployment as it may contain secrets. Deployed resources will not be ffected." + $_ = $deployment | Remove-AzResourceGroupDeployment } } finally { From b4fa4f1c541dd14c2dcd631396e0c600bcf3f735 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Thu, 12 Oct 2023 02:23:53 -0400 Subject: [PATCH 2/3] Update eng/common/TestResources/New-TestResources.ps1 Co-authored-by: Heath Stewart --- eng/common/TestResources/New-TestResources.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index 5e10554bd..f44dc4497 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -805,7 +805,7 @@ try { } Write-Host "Deleting ARM deployment as it may contain secrets. Deployed resources will not be ffected." - $_ = $deployment | Remove-AzResourceGroupDeployment + $null = $deployment | Remove-AzResourceGroupDeployment } } finally { From f854a37fc9fb208e1e8174cedf5d953a6f13f814 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Thu, 12 Oct 2023 11:26:45 -0400 Subject: [PATCH 3/3] Apply suggestions from code review --- eng/common/TestResources/New-TestResources.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index f44dc4497..9d940e723 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -771,7 +771,6 @@ try { -TemplateParameterObject $templateFileParameters ` -Force:$Force } - if ($deployment.ProvisioningState -ne 'Succeeded') { Write-Host "Deployment '$($deployment.DeploymentName)' has state '$($deployment.ProvisioningState)' with CorrelationId '$($deployment.CorrelationId)'. Exiting..." Write-Host @' @@ -804,7 +803,7 @@ try { Remove-Item $templateFile.jsonFilePath } - Write-Host "Deleting ARM deployment as it may contain secrets. Deployed resources will not be ffected." + Write-Host "Deleting ARM deployment as it may contain secrets. Deployed resources will not be affected." $null = $deployment | Remove-AzResourceGroupDeployment }