Reading Time: < 1 minute

It all happened when I tried to execute a plain Get-AzVMSize and it didn’t work. I was getting back something like:

An error occurred while sending the request.
At line:1 char:1
nuke that module
Nuke it! 😛

So, I got a bit mad and this led me to try and uninstall the Az module of PowerShell which as I found out the hard way it has many layers and this is kind of a DLL hell but it’s now called dependency hell.

I tried to check the Microsoft Docs to get some advice and I ended up with this article Uninstall the Azure PowerShell Module. Only that this does not work as expected, either.

So, I looked around a bit more and found on GitHub (link) some people cursing at Microsoft for not knowing how to uninstall its own modules from their own platform. You know how this goes.

Then I realized I have to do it on my own. Duh!

So here is my gist in case someone needs to nuke his/her own PowerShell module.

A word of caution! Make sure you understand what you are doing before you run this in a production machine.
Phew! That was close.

Then I issued the following:

#May the Force be with you
Install-Module Az -AllowClobber -Repository "PSGallery" -Force

And it now works as it supposed to. Hope it helps you too, if you experience the same problems as I had.

Cheers!