Index
Part 1 : Focus on Desired State Configuration in PowerShell
Part 2 : Focus on Deploying with DevOps Pipeline
Part 3 : Focus on Azure Automation Account
Part 4 : Focus on DSC in Automation Account
Scenario
Until now we have seen web servers deployed on new VM’s, how to create DSC Scripts, how to tie this into DevOps and even some cool features of Azure Automation Account. In this final article we will see a great feature that could simplify some our scenarios.
Part 4: Azure Automation DSC
What will I need?
- Azure Subscription (with Permissions to create resources)
- Automation Account
Steps
- On to the State Configuration section of Azure Automation Account. First of all it is located under the Configuration Management Section of our Azure Automation Account.
- As we can see there is already two nodes (Servers) added and I can add more by clicking the “+ Add” button. Note this is to add the device so it can be managed by the Automation Account State Configuration. No DSC configuration is being deployed yet. I also have options like Refresh Frequency (How often to check in if the DSC scripts have updated) and Configuration Mode Frequency(How often the server should check its own compliance by running DSC Script it already has). We also have some Configuration Mode options like ApplyAndMonitor(Once Off Configuration) or ApplyAndAutoCorrect(Configure and fix every time)
- The next step after adding a Node is to add a Configuration. What makes this step easier than writing your own DSC file and compiling it (Part 1) is the Automation Account will do the compilation for you and store this script. No need for Azure Storage account. So it saves you from some complexity.
- I even have the option to go to the gallery and get some new DSC Templates for my nodes.
- For the purposes of this article, we will use our “iis_setup.ps1” file from Part 1 of this series. We can browse and import our DSC file.
- Once the file has been imported we can click on it.
- I still need to compile this file (Which we would have had to do with a PowerShell command if we weren’t using Azure Automation Account). Compilation validates the configuration and allows for the input of parameter values.
- Upon the completion of the compilation, I can add this configuration to one of my nodes.
- Now that everything is configured, let remove the IIS Role from our Web Server and see what happens
- Upon my login after the removal and restart I go to the browser and to my surprise, IIS is still showing up. What happened here?
- Technically it shouldn’t be a surprise because I told the DSC configuration always keep Web Server installed. Clicking on the node I can see it shows compliant
- I can also see upon my restart it took about 2 minutes and 7 seconds to “Correct” my uninstall. Wow, that is neat!
Video
Conclusion
Thank you for following this 4 Part Series on Azure & Desired State Configuration. I hope the items mentioned in here has been beneficial to you and will assist you in your Automation Journey. Keep trying, keep learning and stay positive.
“Automation may be a good thing, but don’t forget that it began with Frankenstein.” – Anonymous