I am not a lover of the CLI, and neither of PowerShell. And for this reason, by being forced to use it more and more assiduously for training sessions, little by little I am getting a taste for this twisted way of doing things.


Well, the truth is, once you understand how it works and the little details that make NOTHING work, it starts to grow in love with you.

In this case, I'm trying to load a resource group, and every time I pass the Remove-AzureRmResourceGroup -Name command , PowerShell returns an error where it tells me that I have to login .

Yes, obviously the first thing I have done has been to install the AzureRM module by opening the PowerShell in administrator mode and entering:

After downloading and installing all the libraries I have entered the command to log into my Azure account


And then I select from all my subscriptions which one I want to use.

Select-AzureSubscription -SubscriptionName testCloud

And, from this point on, whatever I did (register or delete a resource group or resource) it gave me the blessed login error.

What is the solution? The context!!

Not only must I tell PowerShell which subscription I am going to use, but I must also select which context Azure is going to use to apply the commands.

So with the following command:

Set-AzureRmContext -SubscriptionName testCloud

Everything works great again, and PowerShell becomes an excellent tool to work against Azure.

I hope you find it useful.