Problem: When a user login to Azure Pack, they sometimes get the error message: “Failed to load virtual machine templates for subscription <subscription ID>”.
And if the user tries to deploy a a Virtual Machine, there is no templates to choose from.
Cause: I’m not sure what the real cause is, but it seems to be a bug where Azure Pack forgets that information. The template information is there, it’s just Azure Pack that does not read it.
Workaround: Until this is solved by Microsoft in a hotfix or next updated you will have to handle this by yourself.
You can as an Administrator touch the Plans so they are re-synced and it will immediately start working again. Or you can schedule a powershell script to run regularly, touching the plans.
Here is the powershell command I’ve setup for our environment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# Fill in values # Address to your ADFS Server $adfsAddress = 'https://adfs.server.com' # Address to Admin Sites AdminAPI $adminUri = 'https://admin.server.com:30004' # Username to connect to the server $username = 'domain\username' # Use this command once to generate the passwords file # read-host -assecurestring | convertfrom-securestring | out-file C:\path\to\passwords\file\password.txt $password = get-content C:\path\to\passwords\file\password.txt | convertto-securestring $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password $token = Get-AdfsToken -adfsAddress $adfsAddress -credential $credentials $plans = Get-MgmtSvcPlan -AdminUri $adminUri -Token $token -DisableCertificateValidation:$true # Loop though all plans and sync them foreach ($id in $plans) { write-host Syncing $id.DisplayName Sync-MgmtSvcPlan -AdminUri $adminUri -Token $token -DisableCertificateValidation:$true -PlanId $id.id } |
First of all, notice that it’s using a file for the password, to make this automatic.
Use this command once to creat the password.txt file
1 |
read-host -assecurestring | convertfrom-securestring | out-file C:\path\to\passwords\file\password.txt |
And it’s using the Get-AdfsToken function to get the a ADFS Token from our ADFS Server (more info: Get-AdfsToken Function), but you can modify the above script to use a normal Windows Token too if you rather want to use the Windows Authentication site than ADFS. Then use this command (replace line 17 in the script above with this line):
1 |
$Token = Get-MgmtSvcToken –Type Windows –AuthenticationSite https://yourauthenticationsite:30072 – ClientRealm http://azureservices/AdminSite -User $Credentials -DisableCertificateValidation |
One thought on “Azure Pack: Failed to load virtual machine templates for subscription …”