1

Occasionally when executing Invoke-AzureRmResourceAction poweshell command I get the following exception.

Invoke-AzureRmResourceAction : The pipeline has been stopped. Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -R ... + CategoryInfo : CloseError: (:) [Invoke-AzureRmResourceAction], PipelineStoppedException + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceAction Cmdlet

How should I treat this error? Do should I catch it and retry? It normally works to just rerun the command.

Igor
  • 1,349
  • 12
  • 25
NPehrsson
  • 1,548
  • 18
  • 26

1 Answers1

0

If you are using ForEach-Object commandlet, try to replace it with foreach statement.

# your code like this
Get-Something | ForeachObject {Invoke-AzureRmResourceAction $_} 
# replace with this
foreach ($Obj in Get-Something) {
  Invoke-AzureRmResourceAction $Obj
}
Igor
  • 1,349
  • 12
  • 25