Oct 5, 2017. | By: Owen Davies
The creation of a Virtual Machine in Azure is quick, surprisingly quick. However, using the DSC extension adds a lot of time. And this makes me sad. I want to see if I can make it faster.
Making use of ARM Templates is really great. It allows you to define in JSON the full configuration of your Azure environment. You can parametise everything and store it in source control. It gives you a lot of power. Pairing it with the ARM DSC extension is handy as hell. As it gives you the full power of Desired State Configuration when spinning up your Azure Virtual Machine to install any applications or setup anything on the virtual machine that you need.
The ARM DSC extension takes a long time to install, and it’s annoying. I believe a big part of the time taken is due to it needing to install the Windows Management Framework WMF
The Windows Management Framework installs a few things including Powershell, PowerShell DSC, WMI, WinRM. Basically it gives you the ability to install/configure stuff across all the Windows platforms.
Since I think the WMF installation is the big reason behind this slow down I thought I would test that theory against the different versions of WMF and accross both Windows 2012 and 2016. Since WMF version 4 comes installed with 2012, and version 5.1? (I think) with Windows 2016.
So essentially, those 2 configurations should be quicker than the rest.
I’ve created an ARM template, which spins up the necessary components to get a Virtual Machine up. Once the VM is provisioned, it installs the DSC extension and runs the DSC Configuration I have give it. The DSC configuration just creates a folder on the C drive (just to keep it quick and to use as a bench marking example).
Time taken: 00:06:27
Time taken: 10:48
Time taken: 16:29
Time taken: 18:02
Time taken: 16:50
Time taken: 10:33
Time taken: 20:08
Time taken: 19:26
Time taken: 24:24
I have uploaded my ARM Template and PowerShell scripts to GitHub, incase anyone wants to do similar. View the repository here
Installing WMF 4 on Windows 2012 R2 Server seems to be the faster way forward, it takes around 4 minutes to install the DSC extension over the top of the base without DSC and WMF.
I was hoping I would gain a significant time saving by using a different version of WMF if that version of WMF was already installed on that version of Windows. It saves a little bit of time, but nothing spectacular. Interestingly Windows Server 2016 performs a lot worse with installing WMF.
Next steps is to try to create a Virtual Machine image with the extension already installed. Hopefully once I sysprep the image it won’t remove any of the extension properies or information. We shall see.
Til next week!
I'm a .NET Software Engineer that is currently working at SafeToNet. Opinions are my own.
Nant (1) Load testing (1) Visual studio (1) Azure (24) Aws (1) Asp.net (1) Tfs (1) Puppetlabs reports (2) Devops (2) Iis (1) Powershell (6) Arm templates (2) Arm template (1) Azure (5) Powershell (1) Dsc (1) Arm (1) Jekyll (1) Vsts (1)