Long running operation failed with status ‘Failed’…

Ever got this error while trying to do something in Powershell? I got a few ones this week, especially when dealing with Azure ARM cmdlets that basically stacks other cmdlets.

New-AzureRmVirtualNetworkGatewayConnection : Long running operation failed with status 'Failed'.
 At line:1 char:1
 + New-AzureRmVirtualNetworkGatewayConnection -Name "CONN-US-BR-GW" -Res ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : CloseError: (:) [New-AzureRmVirt...tewayConnection], CloudException
 + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkGatewayConnectionCommand

There’s an easy way to dig into this to know what’s really happening. Simply enable debugging:

$DebugPreference = "Continue"

Now you should have details of this error and hopefully, fix whatever is wrong. Of course, you could also debug each cmdlet without enabling it for the entire session using -Debug parameter.


Leave a Reply

Your email address will not be published. Required fields are marked *