File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Tools/PowershellModule/src/Library Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -102,15 +102,18 @@ Function New-ARMObjects
102102
103103 # # Creates the Azure Resource
104104 Write-Information - MessageData " Creating $ ( $Object.ObjectType ) following the ARM Parameter File..."
105- $Result = New-AzResourceGroupDeployment - ResourceGroupName $AzResourceGroup - TemplateFile $Object.TemplatePath - TemplateParameterFile $Object.ParameterPath - Mode Incremental - ErrorAction SilentlyContinue - ErrorVariable objerror
105+ $Result = New-AzResourceGroupDeployment - ResourceGroupName $AzResourceGroup - TemplateFile $Object.TemplatePath - TemplateParameterFile $Object.ParameterPath - Mode Incremental - ErrorAction SilentlyContinue - ErrorVariable objerror - AsJob
106106
107- # # Sets a sleep of 10 seconds after object creation to allow Azure to update creation status, and mark as "running"
108- Start-Sleep - Seconds 10
107+ while ($Result.State -eq " Running" ) {
108+ # # Sets a sleep of 10 seconds after object creation to allow Azure to update creation status, and mark as "running"
109+ Start-Sleep - Seconds 10
110+ }
109111
110112 # # Verifies that no error occured when creating the Azure resource
111- if ($objerror ) {
113+ if ($objerror -or $Result .Error ) {
112114 $ErrReturnObject = @ {
113115 ObjectError = $objerror
116+ JobError = $Result.Error
114117 }
115118 # # Creating the object following the ARM template failed.
116119 Write-Error " Failed to create Azure object." - TargetObject $ErrReturnObject
You can’t perform that action at this time.
0 commit comments