Mar 7, 2017
Written by David Grieser

Custom Azure Machine Frustrations

I’m getting very comfortable with Hyper-V on my Windows 10 Pro machine, and I’m really happy I have this as a development environment. After updating Corgibytes’ Chief Code Whisperer, Scott, about where I was at for a current client, we talked about remote machines and Azure. This lead to attempting to upload a VHD to Azure.

If you wish to share my pain, and come with me on my journey, read on. You will relive my actual experience, which involved looking at all this terminal output and trying to get things to work. If you, as well, have been down this hellish path and are desperate to find a quick way out: skip to the end. You’ll find the straightforward steps to getting things to work.

The Single Line Trap

Scott added me to his Azure instance so I could manage it, and Azure provided a simple enough script to upload the VHD.

Add-AzureVhd -Destination <some_azure_public_writeable_url> -LocalFilePath <local_path_to_vhdx_file>

There I was, thinking it would be awesome to just upload my Hyper-V Windows 10 Base build and go from there. Sadly, I was mistaken. My PowerShell didn’t recognize the command at all. This lead me down the path of having to install modules into PowerShell. At least, I was forward-thinking and opened the PowerShell as Administrator so I could install things. Then, I went to install the module.

PS C:\WINDOWS\system32> Install-Module AzureRM

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\david\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running
 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and
import the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

Ok. So this required installing NuGet and using PSGallery as a repository. And… “You are installing the modules from an untrusted repository.” I’m sorry, what? An untrusted repository. It’s telling me to install the module, but where I’m supposed to get the module is “untrusted.” Really? And this is straight from documentation from Microsoft. IMO that is a terrible pattern. Also, in hindsight, the fact that I had to install this via an administration PowerShell… not good.

Once I got past this, I tried again.

PS C:\WINDOWS\system32> Add-AzureVhd -Destination <some_azure_public_writeable_url> -LocalFilePath <local_path_to_vhdx_file>
Add-AzureVhd : The term 'Add-AzureVhd' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Add-AzureVhd -Destination "<destination_url> ...
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Add-AzureVhd:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

WTF?

After more digging, I discovered that I apparently needed to install the module Azure not AzureRM

facepalm

PS C:\WINDOWS\system32> Install-Module Azure

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
PackageManagement\Install-Package : A command with name 'Get-AzureStorageContainerAcl' is already available on this
system. This module 'Azure' may override the existing commands. If you still want to install this module 'Azure', use
-AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
   Exception
    + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.Pack
   ageManagement.Cmdlets.InstallPackage

Still with the untrusted bit… but I said yes! Except, I was now dealing with the fact that I had other cmdlets (this is what all these scripts are called in PowerShell). Ugh.

I figured, at this point, I should just uninstall the AzureRM and install Azure.

PS C:\WINDOWS\system32> Remove-Module -Name AzureRM
Remove-Module : No modules were removed. Verify that the specification of modules to remove is correct and those
modules exist in the runspace.
At line:1 char:1
+ Remove-Module -Name AzureRM
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Remove-Module], InvalidOperationException
    + FullyQualifiedErrorId : Modules_NoModulesRemoved,Microsoft.PowerShell.Commands.RemoveModuleCommand

WTF?

PS C:\WINDOWS\system32> Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Binary     1.0.0.1    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-Pack...
Script     1.0.0.1    PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCap...
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PS...

Where is Azure?

PS C:\WINDOWS\system32> Find-Module Azure*

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
2.5.0      Azure.Storage                       PSGallery            Microsoft Azure PowerShell - Storage service cmd...
2.5.0      AzureRM.profile                     PSGallery            Microsoft Azure PowerShell - Profile credential ...
3.4.0      Azure                               PSGallery            Microsoft Azure PowerShell - Service Management
3.3.0      AzureRM.ApiManagement               PSGallery            Microsoft Azure PowerShell - Api Management serv...
2.5.0      AzureRM.Automation                  PSGallery            Microsoft Azure PowerShell - Automation service ...
2.5.0      AzureRM.Batch                       PSGallery            Microsoft Azure PowerShell - Batch service cmdle...
2.6.0      AzureRM.Compute                     PSGallery            Microsoft Azure PowerShell - Compute service cmd...
2.5.0      AzureRM.KeyVault                    PSGallery            Microsoft Azure PowerShell - KeyVault service cm...
2.5.0      AzureRM.Backup                      PSGallery            Microsoft Azure PowerShell - Azure Backup servic...
2.5.0      AzureRM.DataFactories               PSGallery            Microsoft Azure PowerShell - DataFactories servi...
2.5.0      AzureRM.Storage                     PSGallery            Microsoft Azure PowerShell - Storage service man...
3.5.0      AzureRM.Resources                   PSGallery            Microsoft Azure PowerShell - Azure Resource Mana...
3.4.0      AzureRM.Network                     PSGallery            Microsoft Azure PowerShell - Network service cmd...
2.5.0      AzureRM.DataLakeAnalytics           PSGallery            Microsoft Azure PowerShell - Data Lake Analytics
2.5.0      AzureRM.Dns                         PSGallery            Microsoft Azure PowerShell - Dns service cmdlets...
2.5.0      AzureRM.Sql                         PSGallery            Microsoft Azure PowerShell - Sql service cmdlets...
2.5.0      AzureRM.Insights                    PSGallery            Microsoft Azure PowerShell - Insights service cm...
2.5.0      AzureRM.OperationalInsights         PSGallery            Microsoft Azure PowerShell - OperationalInsights...
3.3.0      AzureRM.DataLakeStore               PSGallery            Microsoft Azure PowerShell - Data Lake Store
2.5.0      AzureRM.HDInsight                   PSGallery            Microsoft Azure PowerShell - HDInsight service c...
3.4.0      AzureRM.SiteRecovery                PSGallery            Microsoft Azure PowerShell - SiteRecovery servic...
2.5.0      AzureRM.RedisCache                  PSGallery            Microsoft Azure PowerShell - RedisCache service ...
2.5.0      AzureRM.Websites                    PSGallery            Microsoft Azure PowerShell - Websites service cm...
2.5.0      AzureRM.StreamAnalytics             PSGallery            Microsoft Azure PowerShell - StreamAnalytics ser...
2.5.0      AzureRM.Tags                        PSGallery            Microsoft Azure PowerShell - Tags service cmdlet...
2.5.0      AzureRM.TrafficManager              PSGallery            Microsoft Azure PowerShell - TrafficManager serv...
2.5.0      AzureRM.UsageAggregates             PSGallery            Microsoft Azure PowerShell - UsageAggregates ser...
3.5.0      AzureRM                             PSGallery            Azure Resource Manager Module
2.5.0      AzureRM.RecoveryServices            PSGallery            Microsoft Azure PowerShell - RecoveryServices cm...
2.5.0      AzureRM.NotificationHubs            PSGallery            Microsoft Azure PowerShell - NotificationHubs
2.5.0      AzureRM.Cdn                         PSGallery            Microsoft Azure PowerShell - CDN service cmdlets...
2.5.0      AzureRM.LogicApp                    PSGallery            Microsoft Azure PowerShell - LogicApp cmdlets fo...
2.5.0      AzureRM.RecoveryServices.Backup     PSGallery            Microsoft Azure PowerShell - Azure Backup servic...
0.0.1      Azure.AnalysisServices              PSGallery            Microsoft Azure PowerShell - Analysis Services s...
2.5.0      AzureRM.DevTestLabs                 PSGallery            Microsoft Azure PowerShell - DevTestLabs service...
0.11.3     AzureRM.MachineLearning             PSGallery            Microsoft Azure PowerShell - Machine Learning We...
2.5.0      AzureRM.ServerManagement            PSGallery            Microsoft Azure PowerShell - ServerManagement cm...
0.4.3      AzureRM.CognitiveServices           PSGallery            Microsoft Azure PowerShell - Cognitive Services ...
2.5.0      AzureRM.PowerBIEmbedded             PSGallery            Microsoft Azure PowerShell - Power BI Embedded s...
0.3.3      AzureRM.Media                       PSGallery            Microsoft Azure PowerShell - Media service cmdle...
1.2        AzureAutomationRunbookUtilities     PSGallery            A set of utility commands for use with Azure Aut...
1.0.1      AzureStackVaaS                      PSGallery            Azure Stack Validation as a Service Module
1.0.0.0    AzureBlobStorageProvider            PSGallery            A powershell provider for Azure Blob Storage acc...
1.0.0.0    AzureTableEntity                    PSGallery            This module provides functions for managing Azur...
1.0.1      AzureML                             PSGallery            Provides function to get predictions from a pred...
1.0.0.7    AzureRmStorageTable                 PSGallery            Sample functions to add/retrieve/update entities...
0.11.3     AzureRM.Scheduler                   PSGallery            Microsoft Azure PowerShell - Scheduler cmdlets f...
0.0.3      AzureRM.AnalysisServices            PSGallery            Microsoft Azure PowerShell - Analysis Services
0.0.2      AzureRM.ServiceBus                  PSGallery            Microsoft Azure PowerShell - ServiceBus service ...
0.0.2      AzureRM.EventHub                    PSGallery            Microsoft Azure PowerShell - EventHubs service c...
1.1.0      AzureRM.IotHub                      PSGallery            Microsoft Azure PowerShell - IotHub service cmdl...
0.10.3     AzureRM.AzureStackAdmin             PSGallery            Microsoft Azure Stack Administration Module
0.10.2     AzureRM.AzureStackStorage           PSGallery            Microsoft Azure PowerShell - Storage management ...
0.2.3.8    AzureAutomationAuthoringToolkit     PSGallery            Provides cmdlets to make authoring Azure Automat...
2.0.0.52   AzureADPreview                      PSGallery            Azure Active Directory V2 Preview Module. ...
1.2.8      AzureStack                          PSGallery            Azure Stack Adminisitration Module
2.0.0.55   AzureAD                             PSGallery            This is the General Availability release of Azur...
0.3.4      AzureRM.Profile.NetCore.Preview     PSGallery            [PowerShell Core Edition] Microsoft Azure PowerS...
0.3.4      AzureRM.Resources.NetCore.Preview   PSGallery            [PowerShell Core Edition] Microsoft Azure PowerS...
0.2.5.83   AzureExt                            PSGallery            This PowerShell module provides extensions on to...
0.3.4      AzureRM.NetCore.Preview             PSGallery            [PowerShell Core Edition] Azure Resource Manager...
0.1        AzureDiagnosticsAndLogAnalytics     PSGallery            Enable Log Analytics to collect logs from Azure ...
1.0        AzureServiceBusCreation             PSGallery            Module with DSCResource for adding configuration...
0.0.8      AzureProfile                        PSGallery            Microsoft Azure PowerShell
0.9.0      Azure.EventHub                      PSGallery            Provides functions to compute a SAS-authorizatio...
1.3.8      AzureAutomationDebug                PSGallery            Module for debugging Azure Automation runbooks, ...
1.0        AzureStorageTools                   PSGallery            Azure storage tools is a list of tools for worki...
0.8.2      AzurePublicIPAddresses              PSGallery            Gets the IP ranges associated with Azure regions...
1.0.727.1  AzureGraphCmdlets                   PSGallery            Cmdlets for performing operations against Azure ...
1.2.1      AzureAutomationVsoGitSync           PSGallery            AzureAutomationVsoGitSync is a tool to make Cont...
2.1        AzureStackUtils                     PSGallery            Tools to help working with AzureStack TP2
1.3        Azure.ToolKit                       PSGallery            A set of advanced powershell commands to manage ...
0.3.5      AzureResourceSecurity               PSGallery            Configures Azure Resource Manager policies on se...
1.0.0.3    AzureIoT                            PSGallery            Azure IoT Hub Powershell Module
0.3.0.0    AzureRmMinus                        PSGallery            Miscellaneous tools for Azure Resource Manager

Oh, so you installed some of the Azure modules, but failed on the one, and I can’t remove the module?!?

Forced to be resourceful, I then found a new tool: Uninstall-Module.

PS C:\WINDOWS\system32> Uninstall-Module Azure*
Uninstall-Module : The specified name 'Azure*' should not contain any wildcard characters, please correct it and try
again.
At line:1 char:1
+ Uninstall-Module Azure*
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (System.String[]:String[]) [Uninstall-Module], ArgumentException
    + FullyQualifiedErrorId : NameShouldNotContainWildcardCharacters,Uninstall-Module

Of course, why would you NOT support wildcards! Did I mention WTF?

So, I figured, let’s try just the package name.

PS C:\WINDOWS\system32> Uninstall-Module AzureRM

Really? It worked?

PS C:\WINDOWS\system32> Find-Module Azure*

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
2.5.0      Azure.Storage                       PSGallery            Microsoft Azure PowerShell - Storage service cmd...
2.5.0      AzureRM.profile                     PSGallery            Microsoft Azure PowerShell - Profile credential ...
3.4.0      Azure                               PSGallery            Microsoft Azure PowerShell - Service Management
3.3.0      AzureRM.ApiManagement               PSGallery            Microsoft Azure PowerShell - Api Management serv...
2.5.0      AzureRM.Automation                  PSGallery            Microsoft Azure PowerShell - Automation service ...
2.5.0      AzureRM.Batch                       PSGallery            Microsoft Azure PowerShell - Batch service cmdle...
2.6.0      AzureRM.Compute                     PSGallery            Microsoft Azure PowerShell - Compute service cmd...
2.5.0      AzureRM.KeyVault                    PSGallery            Microsoft Azure PowerShell - KeyVault service cm...
2.5.0      AzureRM.Backup                      PSGallery            Microsoft Azure PowerShell - Azure Backup servic...
2.5.0      AzureRM.DataFactories               PSGallery            Microsoft Azure PowerShell - DataFactories servi...
2.5.0      AzureRM.Storage                     PSGallery            Microsoft Azure PowerShell - Storage service man...
3.5.0      AzureRM.Resources                   PSGallery            Microsoft Azure PowerShell - Azure Resource Mana...
3.4.0      AzureRM.Network                     PSGallery            Microsoft Azure PowerShell - Network service cmd...
2.5.0      AzureRM.DataLakeAnalytics           PSGallery            Microsoft Azure PowerShell - Data Lake Analytics
2.5.0      AzureRM.Dns                         PSGallery            Microsoft Azure PowerShell - Dns service cmdlets...
2.5.0      AzureRM.Sql                         PSGallery            Microsoft Azure PowerShell - Sql service cmdlets...
2.5.0      AzureRM.Insights                    PSGallery            Microsoft Azure PowerShell - Insights service cm...
2.5.0      AzureRM.OperationalInsights         PSGallery            Microsoft Azure PowerShell - OperationalInsights...
3.3.0      AzureRM.DataLakeStore               PSGallery            Microsoft Azure PowerShell - Data Lake Store
2.5.0      AzureRM.HDInsight                   PSGallery            Microsoft Azure PowerShell - HDInsight service c...
3.4.0      AzureRM.SiteRecovery                PSGallery            Microsoft Azure PowerShell - SiteRecovery servic...
2.5.0      AzureRM.RedisCache                  PSGallery            Microsoft Azure PowerShell - RedisCache service ...
2.5.0      AzureRM.Websites                    PSGallery            Microsoft Azure PowerShell - Websites service cm...
2.5.0      AzureRM.StreamAnalytics             PSGallery            Microsoft Azure PowerShell - StreamAnalytics ser...
2.5.0      AzureRM.Tags                        PSGallery            Microsoft Azure PowerShell - Tags service cmdlet...
2.5.0      AzureRM.TrafficManager              PSGallery            Microsoft Azure PowerShell - TrafficManager serv...
2.5.0      AzureRM.UsageAggregates             PSGallery            Microsoft Azure PowerShell - UsageAggregates ser...
3.5.0      AzureRM                             PSGallery            Azure Resource Manager Module
2.5.0      AzureRM.RecoveryServices            PSGallery            Microsoft Azure PowerShell - RecoveryServices cm...
2.5.0      AzureRM.NotificationHubs            PSGallery            Microsoft Azure PowerShell - NotificationHubs
2.5.0      AzureRM.Cdn                         PSGallery            Microsoft Azure PowerShell - CDN service cmdlets...
2.5.0      AzureRM.LogicApp                    PSGallery            Microsoft Azure PowerShell - LogicApp cmdlets fo...
2.5.0      AzureRM.RecoveryServices.Backup     PSGallery            Microsoft Azure PowerShell - Azure Backup servic...
0.0.1      Azure.AnalysisServices              PSGallery            Microsoft Azure PowerShell - Analysis Services s...
2.5.0      AzureRM.DevTestLabs                 PSGallery            Microsoft Azure PowerShell - DevTestLabs service...
0.11.3     AzureRM.MachineLearning             PSGallery            Microsoft Azure PowerShell - Machine Learning We...
2.5.0      AzureRM.ServerManagement            PSGallery            Microsoft Azure PowerShell - ServerManagement cm...
0.4.3      AzureRM.CognitiveServices           PSGallery            Microsoft Azure PowerShell - Cognitive Services ...
2.5.0      AzureRM.PowerBIEmbedded             PSGallery            Microsoft Azure PowerShell - Power BI Embedded s...
0.3.3      AzureRM.Media                       PSGallery            Microsoft Azure PowerShell - Media service cmdle...
0.11.3     AzureRM.Scheduler                   PSGallery            Microsoft Azure PowerShell - Scheduler cmdlets f...
0.0.3      AzureRM.AnalysisServices            PSGallery            Microsoft Azure PowerShell - Analysis Services
0.0.2      AzureRM.ServiceBus                  PSGallery            Microsoft Azure PowerShell - ServiceBus service ...
0.0.2      AzureRM.EventHub                    PSGallery            Microsoft Azure PowerShell - EventHubs service c...
1.1.0      AzureRM.IotHub                      PSGallery            Microsoft Azure PowerShell - IotHub service cmdl...
0.10.3     AzureRM.AzureStackAdmin             PSGallery            Microsoft Azure Stack Administration Module
0.10.2     AzureRM.AzureStackStorage           PSGallery            Microsoft Azure PowerShell - Storage management ...
0.2.3.8    AzureAutomationAuthoringToolkit     PSGallery            Provides cmdlets to make authoring Azure Automat...
2.0.0.52   AzureADPreview                      PSGallery            Azure Active Directory V2 Preview Module. ...
1.2.8      AzureStack                          PSGallery            Azure Stack Adminisitration Module
2.0.0.55   AzureAD                             PSGallery            This is the General Availability release of Azur...
0.3.4      AzureRM.Profile.NetCore.Preview     PSGallery            [PowerShell Core Edition] Microsoft Azure PowerS...
0.3.4      AzureRM.Resources.NetCore.Preview   PSGallery            [PowerShell Core Edition] Microsoft Azure PowerS...
0.2.5.83   AzureExt                            PSGallery            This PowerShell module provides extensions on to...
0.3.4      AzureRM.NetCore.Preview             PSGallery            [PowerShell Core Edition] Azure Resource Manager...
0.1        AzureDiagnosticsAndLogAnalytics     PSGallery            Enable Log Analytics to collect logs from Azure ...
1.0        AzureServiceBusCreation             PSGallery            Module with DSCResource for adding configuration...
0.0.8      AzureProfile                        PSGallery            Microsoft Azure PowerShell
0.9.0      Azure.EventHub                      PSGallery            Provides functions to compute a SAS-authorizatio...
1.3.8      AzureAutomationDebug                PSGallery            Module for debugging Azure Automation runbooks, ...
1.0        AzureStorageTools                   PSGallery            Azure storage tools is a list of tools for worki...
0.8.2      AzurePublicIPAddresses              PSGallery            Gets the IP ranges associated with Azure regions...
1.0.727.1  AzureGraphCmdlets                   PSGallery            Cmdlets for performing operations against Azure ...
1.2.1      AzureAutomationVsoGitSync           PSGallery            AzureAutomationVsoGitSync is a tool to make Cont...
2.1        AzureStackUtils                     PSGallery            Tools to help working with AzureStack TP2
1.3        Azure.ToolKit                       PSGallery            A set of advanced powershell commands to manage ...
0.3.5      AzureResourceSecurity               PSGallery            Configures Azure Resource Manager policies on se...
1.0.0.3    AzureIoT                            PSGallery            Azure IoT Hub Powershell Module
0.3.0.0    AzureRmMinus                        PSGallery            Miscellaneous tools for Azure Resource Manager
1.2        AzureAutomationRunbookUtilities     PSGallery            A set of utility commands for use with Azure Aut...
1.0.1      AzureStackVaaS                      PSGallery            Azure Stack Validation as a Service Module
1.0.0.0    AzureBlobStorageProvider            PSGallery            A powershell provider for Azure Blob Storage acc...
1.0.0.0    AzureTableEntity                    PSGallery            This module provides functions for managing Azur...
1.0.1      AzureML                             PSGallery            Provides function to get predictions from a pred...
1.0.0.7    AzureRmStorageTable                 PSGallery            Sample functions to add/retrieve/update entities...

Good one. And you just earned yourself a brand new “WTF?”

Back to doing some more digging online. MSDN Documentation Example 2 says to pipe | the output into Uninstall… Okay.

PS C:\WINDOWS\system32> Find-Module Azure* | Uninstall-Module -Force
PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRM.profile'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'Azure'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRM'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRM.AzureStackAdmin'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRM.AzureStackStorage'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureAutomationAuthoringToolkit'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureADPreview'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureStack'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureAD'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRM.Profile.NetCore.Preview'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRM.Resources.NetCore.Preview'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureExt'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRM.NetCore.Preview'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureDiagnosticsAndLogAnalytics'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureServiceBusCreation'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureProfile'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'Azure.EventHub'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureAutomationDebug'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureStorageTools'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzurePublicIPAddresses'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureGraphCmdlets'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureAutomationVsoGitSync'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureStackUtils'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'Azure.ToolKit'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureResourceSecurity'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureIoT'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRmMinus'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureAutomationRunbookUtilities'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureStackVaaS'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureBlobStorageProvider'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureTableEntity'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureML'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

PackageManagement\Uninstall-Package : No match was found for the specified search criteria and module names 'AzureRmStorageTable'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2137 char:25
+ ...        $null = PackageManagement\Uninstall-Package @PSBoundParameters
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
    + FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage

So, lots of failures… and what do we still have?

PS C:\WINDOWS\system32> Find-Module AzureRM*

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
2.5.0      AzureRM.profile                     PSGallery            Microsoft Azure PowerShell - Profile credential management cmdlets for Azure R...
3.5.0      AzureRM                             PSGallery            Azure Resource Manager Module
3.3.0      AzureRM.ApiManagement               PSGallery            Microsoft Azure PowerShell - Api Management service cmdlets for Azure Resource...
2.5.0      AzureRM.Automation                  PSGallery            Microsoft Azure PowerShell - Automation service cmdlets for Azure Resource Man...
2.5.0      AzureRM.Batch                       PSGallery            Microsoft Azure PowerShell - Batch service cmdlets for Azure Resource Manager
2.6.0      AzureRM.Compute                     PSGallery            Microsoft Azure PowerShell - Compute service cmdlets for Azure Resource Manage...
2.5.0      AzureRM.KeyVault                    PSGallery            Microsoft Azure PowerShell - KeyVault service cmdlets for Azure Resource Manager
2.5.0      AzureRM.Backup                      PSGallery            Microsoft Azure PowerShell - Azure Backup service cmdlets for Azure Resource M...
2.5.0      AzureRM.DataFactories               PSGallery            Microsoft Azure PowerShell - DataFactories service cmdlets for Azure Resource ...
2.5.0      AzureRM.Storage                     PSGallery            Microsoft Azure PowerShell - Storage service management cmdlets for Azure Reso...
3.5.0      AzureRM.Resources                   PSGallery            Microsoft Azure PowerShell - Azure Resource Manager cmdlets.  Manages subscrip...
3.4.0      AzureRM.Network                     PSGallery            Microsoft Azure PowerShell - Network service cmdlets for Azure Resource Manager
2.5.0      AzureRM.DataLakeAnalytics           PSGallery            Microsoft Azure PowerShell - Data Lake Analytics
2.5.0      AzureRM.Dns                         PSGallery            Microsoft Azure PowerShell - Dns service cmdlets for Azure Resource Manager
2.5.0      AzureRM.Sql                         PSGallery            Microsoft Azure PowerShell - Sql service cmdlets for Azure Resource Manager
2.5.0      AzureRM.Insights                    PSGallery            Microsoft Azure PowerShell - Insights service cmdlets for Azure Resource Manager
2.5.0      AzureRM.OperationalInsights         PSGallery            Microsoft Azure PowerShell - OperationalInsights service cmdlets for Azure Res...
3.3.0      AzureRM.DataLakeStore               PSGallery            Microsoft Azure PowerShell - Data Lake Store
2.5.0      AzureRM.HDInsight                   PSGallery            Microsoft Azure PowerShell - HDInsight service cmdlets for Azure Resource Manager
3.4.0      AzureRM.SiteRecovery                PSGallery            Microsoft Azure PowerShell - SiteRecovery service cmdlets for Azure Resource M...
2.5.0      AzureRM.RedisCache                  PSGallery            Microsoft Azure PowerShell - RedisCache service cmdlets for Azure Resource Man...
2.5.0      AzureRM.Websites                    PSGallery            Microsoft Azure PowerShell - Websites service cmdlets for Azure Resource Manager
2.5.0      AzureRM.StreamAnalytics             PSGallery            Microsoft Azure PowerShell - StreamAnalytics service cmdlets for Azure Resourc...
2.5.0      AzureRM.Tags                        PSGallery            Microsoft Azure PowerShell - Tags service cmdlets for Azure Resource Manager
2.5.0      AzureRM.TrafficManager              PSGallery            Microsoft Azure PowerShell - TrafficManager service cmdlets for Azure Resource...
2.5.0      AzureRM.UsageAggregates             PSGallery            Microsoft Azure PowerShell - UsageAggregates service cmdlets for Azure Resourc...
2.5.0      AzureRM.RecoveryServices            PSGallery            Microsoft Azure PowerShell - RecoveryServices cmdlets for Azure Resource Manager
2.5.0      AzureRM.NotificationHubs            PSGallery            Microsoft Azure PowerShell - NotificationHubs
2.5.0      AzureRM.Cdn                         PSGallery            Microsoft Azure PowerShell - CDN service cmdlets for Azure Resource Manager
2.5.0      AzureRM.LogicApp                    PSGallery            Microsoft Azure PowerShell - LogicApp cmdlets for Azure Resource Manager
2.5.0      AzureRM.DevTestLabs                 PSGallery            Microsoft Azure PowerShell - DevTestLabs service cmdlets for Azure Resource Ma...
0.11.3     AzureRM.MachineLearning             PSGallery            Microsoft Azure PowerShell - Machine Learning Web Services cmdlets for Azure R...
2.5.0      AzureRM.ServerManagement            PSGallery            Microsoft Azure PowerShell - ServerManagement cmdlets for Azure Resource Manager
2.5.0      AzureRM.RecoveryServices.Backup     PSGallery            Microsoft Azure PowerShell - Azure Backup service cmdlets for Azure Resource M...
0.4.3      AzureRM.CognitiveServices           PSGallery            Microsoft Azure PowerShell - Cognitive Services management cmdlets for Azure R...
2.5.0      AzureRM.PowerBIEmbedded             PSGallery            Microsoft Azure PowerShell - Power BI Embedded service management cmdlets for ...
0.3.3      AzureRM.Media                       PSGallery            Microsoft Azure PowerShell - Media service cmdlets for Azure Resource Manager
0.11.3     AzureRM.Scheduler                   PSGallery            Microsoft Azure PowerShell - Scheduler cmdlets for Azure Resource Manager
0.0.3      AzureRM.AnalysisServices            PSGallery            Microsoft Azure PowerShell - Analysis Services
0.0.2      AzureRM.ServiceBus                  PSGallery            Microsoft Azure PowerShell - ServiceBus service cmdlets for Azure Resource Man...
0.0.2      AzureRM.EventHub                    PSGallery            Microsoft Azure PowerShell - EventHubs service cmdlets for Azure Resource Manager
1.1.0      AzureRM.IotHub                      PSGallery            Microsoft Azure PowerShell - IotHub service cmdlets for Azure Resource Manager
0.10.3     AzureRM.AzureStackAdmin             PSGallery            Microsoft Azure Stack Administration Module
0.10.2     AzureRM.AzureStackStorage           PSGallery            Microsoft Azure PowerShell - Storage management cmdlets for Azure Stack
0.3.4      AzureRM.Profile.NetCore.Preview     PSGallery            [PowerShell Core Edition] Microsoft Azure PowerShell - Profile credential mana...
0.3.4      AzureRM.Resources.NetCore.Preview   PSGallery            [PowerShell Core Edition] Microsoft Azure PowerShell - Azure Resource Manager ...
0.3.4      AzureRM.NetCore.Preview             PSGallery            [PowerShell Core Edition] Azure Resource Manager Module - Management Cmdlets f...
0.3.0.0    AzureRmMinus                        PSGallery            Miscellaneous tools for Azure Resource Manager
1.0.0.7    AzureRmStorageTable                 PSGallery            Sample functions to add/retrieve/update entities on Azure Storage Tables from ...

Everything still installed! Awesome.

That was it.

”I give up. It’s clobbering time!”

clobbering time

PS C:\WINDOWS\system32> Install-Module Azure -AllowClobber

Alright, any of the AzureRM cmdlets that use whatever I overwrote… Oh well.

So, back to uploading this VHD file. I opened up a fresh PowerShell and was excited to start a 14GB upload to Azure.

PS C:\Users\david> Add-AzureVhd -Destination <some_azure_public_writeable_url> -LocalFilePath <local_path_to_vhdx_file>
Add-AzureVhd : The 'Add-AzureVhd' command was found in the module 'Azure', but the module could not be loaded. For
more information, run 'Import-Module Azure'.
At line:1 char:1
+ Add-AzureVhd
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Add-AzureVhd:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

Okay…

PS C:\Users\david>  Import-Module Azure
Import-Module : File C:\Program Files\WindowsPowerShell\Modules\Azure\3.4.0\Azure.psm1 cannot be loaded because
running scripts is disabled on this system. For more information, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:2
+  Import-Module Azure
+  ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand

(╯°□°)╯︵ ┻━┻

More Google searching later… About Execution Policies.

PS C:\Users\david> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

”So… Can I upload now?”

PS C:\Users\david> Add-AzureVhd -Destination <some_azure_public_writeable_url> -LocalFilePath <local_path_to_vhdx_file>
WARNING: Microsoft Azure PowerShell collects data about how users use PowerShell cmdlets and some problems they
encounter.  Microsoft uses this information to improve our PowerShell cmdlets.  Participation is voluntary and when you
 choose to participate your device automatically sends information to Microsoft about how you use Azure PowerShell.

If you choose to participate, you can stop at any time by using Azure PowerShell as follows:
1. Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the
AzureResourceManager module
To disable data collection: PS > Disable-AzureDataCollection

If you choose to not participate, you can enable at any time by using Azure PowerShell as follows:
1. Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the
AzureResourceManager module
To enable data collection: PS > Enable-AzureDataCollection

Select Y to enable data collection [Y/N]:
WARNING: You choose not to participate in Microsoft Azure PowerShell data collection.
WARNING: The setting profile has been saved to the following path 'C:\Users\david\AppData\Roaming\Windows Azure
Powershell\AzureDataCollectionProfile.json'.
Add-AzureVhd : '<local_path_to_vhdx_file>.vhdx' is not a valid VHD
file.
At line:1 char:1
+ Add-AzureVhd -Destination <some_azure_public_writeable_url> ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-AzureVhd], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.WindowsAzure.Commands.ServiceManagement.Stora
   geServices.AddAzureVhdCommand

(┛ಸ_ಸ)┛彡┻━┻

Not terrible. But I was still facing another issue. By default Hyper-V created VHDX images, so that was annoying considering Azure just wants a VHD. Now, I had to figure out the VHD file… from my Hyper-V.

Also, I appreciate the built-in help links.

Success.

Convert-VHD -Path  <local_path_to_vhdx_file>.vhdx -DestinationPath  <new_path_to_some>.vhd

Be warned, though, this first does an MD5 Hash on the file, which in my case was 12GB. It took about seven minutes. Then, I still needed to upload it. With 5.3Mbps throughput, it took about five hours.

Solution

If you actively work with Azure, you might want to consider NOT using -AllowClobber and possibly break your setup. Otherwise, here are the steps to get Add-AzureVhd to work.

Admin PowerShell

PS C:\WINDOWS\system32> Install-Module Azure -AllowClobber

Personal PowerShell

PS C:\Users\david> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
PS C:\Users\david> Convert-VHD -Path  <local_path_to_vhdx_file>.vhdx -DestinationPath  <new_path_to_some>.vhd
PS C:\Users\david> Add-AzureVhd -Destination <some_azure_public_writeable_url> -LocalFilePath <local_path_to_vhdx_file>

Have you had a similar problem with using Azure and PowerShell? Is there a cmdlet I missed that I could have used to help my issues? Comment below to let me know.

And I hope I shared this in time to help at least some of you avoid these Azure machine frustrations!

Want to be alerted when we publish future blogs? Sign up for our newsletter!