In the last Powerbits post, I talked about the basics of PowerShell and how it’s the foundational building block for DSC. In this post we will be covering the required installations for DSC and how to connect to Azure.
I will be utilizing my MSDN subscription benefits to connect to Azure as my testing platform. If you have not checked out Azure, now is the time to do so – It makes a great testing platform for this type of work. For one, it’s free and I do not need to ask operations to spin up a new VM for my test/learn environment. Second, my “Alpha” development for system configuration could run into issues (OK most likely). Having Azure for the “what if” testing is a perfect use of the free $100 a month credit.
What I will be covering in this post:
I will cover some of the standard installs for PowerShell and DSC. This is not by any means a final listing. New updates, packages and toolkits are coming out every day. It will, however, give you a standard set of tools to get started with. I will be using the NuGet packaging system and Chocolatey to install my common tool list.
What I will not be covered in this post:
I will not be covering scripting for DSC or Azure Workflow.
Goal of the post:
The goal of the posting is to get you familiar with the different required updates and downloads for Azure, DSC and PowerShell Automation.
PowerShell Azure Basics:
In order to get the Azure cmdlets you need to download Windows Azure PowerShell. You can do this by either using Web Platform Installer or by using Chocolatey.
My preference is to use the Chocolatey. If you need to install Chocolatey, open a PowerShell command prompt as Administrator and copy in the following:
- iex ((new-object net.webclient).DownloadString(‘https://chocolatey.org/install.ps1’))
Here is my list of Azure downloads from Chocolatey:
- choco install WindowsAzurePowershell
- choco install WindowsAzureLibsForNet
- choco install AzureStorageExplorer
You can now test the Azure cmdlets by typing into the command window Get-Azure Pub then hit tab to auto complete the Get-AzurePublishSettingFile, or just Get-Azu to go thru the listing of cmdlets.
Ok, I know this is very basic. I wanted to set the foundation before diving into the “good stuff”.
Next is the setup for the Desired State Configuration (DSC). Why is DSC important? It is the toolset used to create standard environment configuration using a push and pull deployment practice. More on that later.
DSC install and setup.
Copy and paste the following into the PowerShell window. Remember to open as Administrator and a reboot is required.
Get the Nuget gallery for DSC http://msconfiggallery.cloudapp.net/packages Awesome!!!
###### Copy Start ######
Invoke-WebRequest -Uri ‘http://nuget.org/nuget.exe’ -OutFile “$env:TEMP\NuGet.exe”
&”$env:TEMP\NuGet.exe” install xJea -NoCache -Source http://msconfiggallery.cloudapp.net/api/v2/ -ExcludeVersion -PackageSaveMode “nuspec” -OutputDirectory “$env:ProgramFiles\WindowsPowerShell\Modules”
&’winrm’ quickconfig –quiet
###### Copy End ######
Next is the Windows Management Framework 5.0
###### Copy Start ######
Invoke-WebRequest -Uri ‘http://download.microsoft.com/download/5/5/2/55277C4B-75D1-40FB-B99C-4EAFA249F645/WindowsBlue-KB2894868-x64.msu’ -OutFile “$env:TEMP\WindowsBlue-KB2894868-x64.msu”
###### Copy End######
You will need to reboot your system.
After the reboot, you can then look for the xAzure DSC tools.
Open the PowerShell command as Administrator and type in the
- Find-module xAzure
Notice that it is scanning the NuGet galleries
Next, you need to import the module into your profile and PowerShell environment.
Type in the following:
- Install-Module –Name xAzure
- Install-Module -Name xPSDesiredStateConfiguration
Now to see the new cmdlets available, type in Get-DscResource to view all the newly install resources.
Now you have the module for Azure or PSDesiredStateConfiguration installed and ready for you to use. To get a quick look at what inside of the modules, you can review the content at “C:\Windows\System32\WindowsPowerShell\v1.0\Modules”
For example, the PSDesiredStateConfiguration has the classic layout for DSC. As you checkout the other modules you will notice that there are .psd1, .psm1 and .mof files that contain the modules logic. More on this in a later post.
Since the goal of this post is for a basic system setup to run Azure and DSC modules and commands, I have place some additional resources for those who wish to dive a little deeper.
- Windows PowerShell Desired State Configuration Overview
- Introducing PowerShell Desired State Configuration (DSC)
I will be covering more cool tools and diving deeper into Desired State Configuration (DSC) foundational technologies.