Max Trinidad has built a function to remove older versions of the Azure module:
As you probably know by now, “Azure RM” modules has been renamed to “Az” Module. Microsoft want you to start using this module moving forward. Currently, this new release is on version 0.5.0, and you’ll need to remove the any previous module(s) installed. Information about Azure PowerShell can be found on the following link.
Now, there’s always been a tedious task when manually removing module dependencies, and there’s no exception with the “Az” module. So, we can all take advantage to PowerShell and create a script to work around this limitation.
And, below is a few options.
Max also provides us a couple of other options as well.