@@ -723,29 +723,27 @@ try {
723723 Log $msg
724724
725725 $deployment = Retry {
726- $lastDebugPreference = $DebugPreference
727- try {
728- if ($CI ) {
729- $DebugPreference = ' Continue'
730- }
731- New-AzResourceGroupDeployment - Name $BaseName - ResourceGroupName $resourceGroup.ResourceGroupName - TemplateFile $templateFile.jsonFilePath - TemplateParameterObject $templateFileParameters - Force:$Force
732- } catch {
733- Write-Output @'
726+ New-AzResourceGroupDeployment `
727+ - Name $BaseName `
728+ - ResourceGroupName $resourceGroup.ResourceGroupName `
729+ - TemplateFile $templateFile.jsonFilePath `
730+ - TemplateParameterObject $templateFileParameters `
731+ - Force:$Force
732+ }
733+
734+ if ($deployment.ProvisioningState -ne ' Succeeded' ) {
735+ Write-Host " Deployment '$ ( $deployment.DeploymentName ) ' has state '$ ( $deployment.ProvisioningState ) ' with CorrelationId '$ ( $deployment.CorrelationId ) '. Exiting..."
736+ Write-Host @'
734737#####################################################
735738# For help debugging live test provisioning issues, #
736- # see http://aka.ms/azsdk/engsys/live-test-help, #
739+ # see http://aka.ms/azsdk/engsys/live-test-help #
737740#####################################################
738741'@
739- throw
740- } finally {
741- $DebugPreference = $lastDebugPreference
742- }
742+ exit 1
743743 }
744744
745- if ($deployment.ProvisioningState -eq ' Succeeded' ) {
746- # New-AzResourceGroupDeployment would've written an error and stopped the pipeline by default anyway.
747- Write-Verbose " Successfully deployed template '$ ( $templateFile.jsonFilePath ) ' to resource group '$ ( $resourceGroup.ResourceGroupName ) '"
748- }
745+ Write-Host " Deployment '$ ( $deployment.DeploymentName ) ' has CorrelationId '$ ( $deployment.CorrelationId ) '"
746+ Write-Host " Successfully deployed template '$ ( $templateFile.jsonFilePath ) ' to resource group '$ ( $resourceGroup.ResourceGroupName ) '"
749747
750748 $deploymentOutputs = SetDeploymentOutputs $serviceName $context $deployment $templateFile
751749
0 commit comments