The PowerShell DSC extension for Azure Virtual Machines is an immensely useful feature. It allows you to apply DSC configurations against your Azure Virtual Machine.
Unfortuantly the “reboot node if needed” setting just wasn’t working for me.
The way the DSC extension works
You add the DSC extension to you Virtual Machine, and then point it at a DSC configuration file, and any parameters that you need to pass to it. And it should apply all the configurations that you have specified in the DSC configuration file.
There is a setting that you can configure at the top of your configuration file called LocalConfigurationManger (LCM). One of the settings allows DSC to reboot if one of the steps in the configuration requires a reboot. Otherwise it will just sit there waiting for you to reboot it yourself, hardly automated.
Example DSC configuration with LCM
configuration MyServerConfig
{
param(
[Parameter(Mandatory)]
[string]$serverName
)
Import-DscResource xComputerManagement
Node $serverName
{
LocalConfigurationManager
{
RebootNodeIfNeeded = $True
}
}
}
The issue
Everytime I ran the deployment, the RebootNodeIfNeeded setting kept getting set to $false. Unfortuantly also, the deployments took hours, so tracking down the issue and getting feedback was an immensely slow process.
This really stumped me for some time, after digging into the logs and checking things out I stumbled accross this page on powershell.org
Versioning… I was using version 2.9 trying out version 2.15 as they discovered, fixes this issue. Now trying with the latest version (2.26) and everything seems fine also.
Conclusion
Making sure you’re upto date obviously should be the first thing to check. And stupidity kept me from checking this. But it took a hell of a lot of googleing to find the answer to this. Hopefully this post will save somebody some time and some hair.