Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Hosted-services / Azure

Articles: Azure ARM DSC Extension LCM Settings rebootnodeifneeded Not Working

0.00/5 (No votes)
9 Feb 2020CPOL1 min read 1.1K  
Fix for persistent issue with reboot node if needed
The PowerShell DSC extension for Azure Virtual Machines offers seamless configuration application, yet encountered a persistent issue with the reboot node if needed setting, resolved in version 2.15, highlighting the importance of version compatibility.

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.

Unfortunately, the “reboot node if needed” setting just wasn’t working for me.

The Way the DSC Extension Works

You add the DSC extension to your 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 LocalConfigurationManager (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

PowerShell
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. Unfortunately 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 Googling to find the answer to this. Hopefully, this post will save somebody some time and some hair.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)