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.


Read More

Running Azure Powershell behind a proxy

Quick post for today. I needed to use PowerShell from a customer site this week and I was getting errors right after trying to login into the console. The error message was just the HTML of the proxy server blocking my attempt of connection. Turns out Powershell does not load proxy configuration from IE automatically and you need to tell it to use manually. Run PowerShell as administrator and execute the following:

PS C:\WINDOWS\system32> netsh winhttp import proxy source=ie

Current WinHTTP proxy settings:
 Proxy Server(s) :
 Bypass List : (none)

And if your proxy server needs authentication:

 $webclient=New-Object System.Net.WebClient

That’s it! Enjoy your session of PowerShell over proxy.

Read More

Configuring Point-to-site in Azure Resource Manager

In addition to creating a site to site connection in Azure, you can also use the same gateway to configure a Point-to-site connection. Point-to-site configuration allows a secure connection from a client computer, individually, to the virtual network in Azure. It’s a very good solution when you need to work remotely or when you need to give temporary access to a customer to connect to a virtual network.


Read More

How to reset Azure ARM VM credentials

Just a quick tip for today. If you need to reset the administrative credentials of your Virtual Machine running ARM (IaaS v2), use one of the two solutions below:

Using Powershell cmdlets:

Download from: http://aka.ms/webpi-azps

PS C:\> Login-AzureRmAccount
PS C:\> Set-AzureRmVMAccessExtension -ResourceGroupName RESOURCE_GROUP_NAME -Name HOSTNAME -VMName VM_NAME -UserName USER -Password PASSWORD

Using the CLI:

Download from: https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/

> azure login
> azure config mode arm
> azure vm reset-access -g RESORCE_GROUP_NAME -n VM_NAME -u USER -p PASSWORD

That’s it! You should be able to login to your VM now.

Read More

Azure “Always On” VPN Point to Site Workaround

Hello, everyone! Recently, I talked about how to deconstruct the Azure VPN client (article in Portuguese) detailing a process to manually create the VPN connection between On-premises and Azure. Today I’m going to give a workaround to keep the connection alive all the time. As you may know, there’s no built-in functionality in Windows to automatically reconnect or start the connection after the boot process. The idea is to use the information we gathered from the first article to create a script to close the connection between the parties.


Read More

Web App analytics with Azure Application Insights and WordPress

Application insights has been a great ally to help developers detect, diagnose and understand users behavior in applications. For those new to this platform, Application Insights is an analytics solution that monitors live applications no matter if they are web or a stand-alone app running Windows, iOS, OSX or Android.


In this article, we talk about a new plugin released by Microsoft that makes very easy to integrate Azure Application Insights with WordPress.


Read More