@@ -162,36 +162,35 @@ $resourceTestCommands = @(
162
162
@ {Name = " Az.Websites" ; Command = {Get-AzWebApp - ResourceGroupName $resourceGroupName }}
163
163
)
164
164
165
- # $generalCommands = @(
166
- # @{
167
- # Name = "Import Az.Accounts in Parallel";
168
- # Command = {
169
- # if ($null -ne $env:SYSTEM_DEFINITIONID) {
170
- # Write-Host "Skipping because 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications."
171
- # return
172
- # }
173
- # $importJobs = @()
174
- # 1..10 | ForEach-Object {
175
- # $importJobs += Start-Job -name "import-no.$_" -ScriptBlock { Import-Module Az.Accounts; Get-AzConfig; }
176
- # }
177
- # $importJobs | Wait-Job
178
- # $importJobs | Receive-Job
179
- # $importJobs | ForEach-Object {
180
- # if ("Completed" -ne $_.State) {
181
- # throw "Some jobs have failed."
182
- # }
183
- # }
184
- # };
185
- # Retry = 0; # no need to retry
186
- # }
187
- # )
165
+ $generalCommands = @ (
166
+ @ {
167
+ Name = " Import Az.Accounts in Parallel" ;
168
+ Command = {
169
+ if ($null -ne $env: SYSTEM_DEFINITIONID -or $null -ne $ env: Release_DefinitionId -or $null -ne $ env: AZUREPS_HOST_ENVIRONMENT ) {
170
+ Write-Warning " Skipping because 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications."
171
+ return
172
+ }
173
+ $importJobs = @ ()
174
+ 1 .. 10 | ForEach-Object {
175
+ $importJobs += Start-Job - name " import-no.$_ " - ScriptBlock { Import-Module Az.Accounts; Get-AzConfig ; }
176
+ }
177
+ $importJobs | Wait-Job
178
+ $importJobs | Receive-Job
179
+ $importJobs | ForEach-Object {
180
+ if (" Completed" -ne $_.State ) {
181
+ throw " Some jobs have failed."
182
+ }
183
+ }
184
+ };
185
+ Retry = 0 ; # no need to retry
186
+ }
187
+ )
188
188
189
189
if ($Reverse.IsPresent ){
190
190
[array ]::Reverse($resourceTestCommands )
191
191
}
192
192
193
- # $resourceCommands=$resourceSetUpCommands+$resourceTestCommands+$resourceCleanUpCommands+$generalCommands
194
- $resourceCommands = $resourceSetUpCommands + $resourceTestCommands + $resourceCleanUpCommands
193
+ $resourceCommands = $resourceSetUpCommands + $resourceTestCommands + $resourceCleanUpCommands + $generalCommands
195
194
196
195
$startTime = Get-Date
197
196
$resourceCommands | ForEach-Object {
0 commit comments