Thursday, October 20, 2016

Azure Automation Agent Force Check In Using PowerShell

Azure Automation is a tool that a System Administrator dreamed of that quickly became reality.  With Azure Automation you can automate jobs. tasks, configurations and deployments against resources in Azure, on-premises, and even in other cloud providers like Amazon Web Services (AWS). DevOps is a word that is being used quite frequently and Azure Automation builds on this culture for an organization's infrastructure.

The reason I am writing this blog post is because I recently worked on a project where the Web Server was not playing nice with the DSC configuration in Azure. The agent was not checking back into the host server to check its configuration. This post shows how to speed this up.

Another Admin removed the Web Server role and DSC normally checks in to put it back. In this case it dd not. See the screenshots below to view the inconsistency with the server.

From within the server or Remote PowerShell running the Update-DscConfiguration -Wait -Verbose command started the pulling of the configuration file from the DSC Node Server.

The Virtual Machine still did not start the configuration even though the Update was initiated. The work around with this is, as I found was to you use the Start-DscConfiguration -UseExisitng -Verbose cmdlet. This will reference the MOF file on the local box and fire off the agent to talk to the DSC node server forcefully. At this point the Web Server started to install the configuration as seen below.

And within a few periodic checks our DSC configuration was again consistent.

I hope this helps someone. Especially if your new with Azure Automation.

If you have not used Azure as yet and want to get started click here

Happy Scripting!!!

Adnan Cartwright