When using Azure Dedicated Hosts, Microsoft offers a way to have more control over maintenance events that occur on the host. This is done through “Maintenance Control” configuration objects.
I’m attempting to test this, and have been receiving failures that I need to investigate.
To start, I created a host group and a host in the Azure Portal. Then I created a maintenance configuration.
Now when I go into the Maintenance Configuration and try to assign my Host, the activity fails:
After a few minutes, this shows up in the Hosts activity log:
With this detail:
I have two assumptions to test at this point:
- Maybe something is broken in the portal, because the error indicates it is trying to create an assignment with “dummyname” which doesn’t look right
- Perhaps a VM must be assigned to the Dedicated Host before a Maintenance Configuration can be assigned to it
I wanted to test #1 before #2 to reduce the number of variables, and I used Az PowerShell to do so.
First, I Get-AzMaintenanceConfiguration:
Then I create an assignment, using PowerShell splatting:
$AssignmentParams = @{ ResourceGroupName = $resourcegroupname ResourceParentType = "hostGroups" ResourceParentName = "eastus2-hostgroup" ResourceType = "hosts" ResourceName = "eastus2-host1" ProviderName = "Microsoft.Compute" ConfigurationAssignmentName = "$($config.name)-host1" MaintenanceConfigurationId = $config.Id Location = $config.location } New-AzConfigurationAssignment @AssignmentParams |
Surprisingly this seemed to work, with no errors output. I say surprisingly, because I’m sure I tested this with errors last week before I decided to sit down and write a blog post about it!
Performing a Get-AzConfigurationAssignment with a smaller set of parameters in a hashtable returns the assignment that I expect to see:
$GetAssignmentParams = @{ ResourceGroupName = $resourcegroupname ResourceParentType = "hostGroups" ResourceParentName = "eastus2-hostgroup" ResourceType = "hosts" ResourceName = "eastus2-host1" ProviderName = "Microsoft.Compute" } Get-AzConfigurationAssignment @GetAssignmentParams |
When I look in the Portal, I can see the assignment on the Host:
And it also appears when looking at the Maintenance Configuration too: