Windows Azure Pack – Failed to Register Virtual Machine Cloud Provider

I was installing Windows Azure Pack to a different lab environment (having not had a problem on previous occasions) and everything was fine until connecting to Virtual Machine Manager.  Every time I tried, I got the error “Failed to register virtual machine cloud provider”:

WAP-VMM_FailedToRegister

Clicking on ‘Details’ only gave “An error occurred while processing this request.” I did some troubleshooting, including following the great blog article from Microsoft Troubleshooting Windows Azure Pack, SPF & VMM, all of which didn’t point to the problem.

I went to the Event Viewer on the server running Windows Azure Pack (only an express installation in this lab) and navigated to ‘Applications and Services Logs > Microsoft > WindowAzurePack > MgmtSvc-AdminAPI > Operational‘ and there were several long errors in there.  They were all slightly different in content, but all started the same way:

  • Resource provider unexpected exception for proxy request with verb ‘GET’, operation name ‘Outgoing admin proxy call’

Sounds like a PowerShell issue…

Reading further into each error, I spotted the following:

  • Invoking method GetSupportedQueryOptions of type Microsoft.SystemCenter.Foundation.Psws.Spf.SpfOperationManager failed. Cause of the problem: Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective execution policy of Unrestricted.

Having a look at the Execution Policy, it was indeed set to Unrestricted.  I found in Group Policy that the setting ‘Turn on Script Execution’ was enabled.  I removed this, ran a gpupdate and checked the Execution Policy again, which had now reverted to Restricted.  I also ran update on the Service Provider Foundation server and check it was now set to Restricted.

Connecting to Virtual Machine Manager now worked as expected.