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) https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sa-create-vm-specialized 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 (https://social.msdn.microsoft.com/Forums/azure/en-US/4e422b3f-42b0-48bd-90d4-55bb7a25aca1/migrate-converted-vhd-to-azure-stack) 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.