Using New-AzureRmVM with an existing VHD on Azure Stack fails

A quick post: in testing out using an existing VHD file for a new VM in Azure Stack, using the PowerShell command New-AzureRmVM along the lines of this guide in Azure (public) failed at the step of actually creating the VM after 5 minutes or so with the error:

New-AzureRmVM : Long running operation failed with status ‘Failed’. Additional Info:’Vm Extensions cannot be installed on VM ‘vmname as guest agent is not provisioned on the VM.

Having a quick search lead me to this post ( where the solution was to use the JSON template as an example. In the answer it detailed that the BGInfo extension was trying to be deployed, which isn’t available in Azure Stack at this time.

With this new piece of information, New-AzureRmVM has the parameter -DisableBginfoExtension available and when running the command with that parameter, it completed successfully.