How to Participate in the Desired State Configuration (DSC) Community
As you begin to leverage Desired State Configuration (DSC) in evaluations, lab, or production, you will ultimately need to consume and create your own DSC resources. Leveraging and supporting the community is a really great place to learn what you can do and share your own work with others who may help you develop these resources even further.
As IT pros, we sometimes need to take on a tiny persona of a developer as we create scripts to automate our day-to-day jobs. In this post I will walk you through the procedure of working with these repositories, enabling you to version control your work, and even have it pulled back into the main community library.
Editor’s note: Need to catch up? Check out our previous articles in this series:
- Deploying a Desired State Configuration Web Host Using Powershell
- Deploying a Desired State Configuration Web Host Using DSC
- Desired State Configuration Host Deployment: Local Configuration Manager
- Desired State Configuration and Local Configuration Manager
- What Can I Configure Using Desired State Configuration?
- How Do I Create a Desired State Configuration?
- How to Publish a Desired State Configuration
- Using Community Desired State Configuration Resources
DSC and GitHub
We are going to start off with a quick introduction to GitHub, with which we will connect and access the PowerShell.org repository of DSC resources. These resources are maintained and updated quite regularly.
Read the Best Personal and Business Tech without Ads
Staying updated on what is happening in the technology sector is important to your career and your personal life but ads can make reading news, distracting. With Thurrott Premium, you can enjoy the best coverage in tech without the annoying ads.
Browsing this repository, you will see that a number of interesting DSC resources are already available to use, including community versions of some open source providers recently shared by the Microsoft Powershell team.
And new resources created by the community, which currently include the following.
From GIT, simply download a copy of these to your system and then publish them to your pull server by selecting the option in the right action pane called Download ZIP.
I would encourage you to participate in the community, which could not be simpler and only needs a few simple steps to get started.
On your workstation, start by downloading and installing a copy of the GIT tools, these are free and updated regularly. Installation is painless and will add an extension to your Explorer shell and some new utilities to your command interface. The main one of concern is called git.
Create a Free Account
Register for a free account on GitHub.com. This will permit you to host a copy of the community DSC resources in your personal account which you can then edit as you like, updating your change history, and only when you are happy that your work is stable, you can then request that the maintainer of the community DSC resources update the main repository with your contributions.
Create a Fork
With your free account created, creating a copy of the community resources could not be simpler. Navigate back to the PowerShell.org community repository and click Fork. A copy of the repository will be created in your new account, similar to the example below.
Clone the Fork
This copy is now your starting point. You can check this out to your computer, edit it as you wish, create new resources, etc. Once you are satisfied that all the changes you wish to make are completed, you can request that the changes are pulled back to the main repository.
Using our recently installed GIT tools, we can clone this repository to your workstation so that you can begin to use and edit the resources. Navigate the the folder on your workstation you plan to use as the working folder, and then issue the following command. Remember to replace the username with your personal account name.
git clone https://github.com/username/DSC.git
This will instruct GIT to create a local clone of your repository.
Our new clone is now associated with our personal copy of the resources, which is known to Git as Origin. But as we are doing this to support the community, we need to also make an association to the original PowerShell.org version of the repository, which we will refer to as Upstream. This is important, as we might want to get any new updates others may be adding to the main repository to be merged with the version we are working on. And, of course, we’ll want to have our updated pulled into the upstream version when we are ready.
To accomplish this, we update Git with the following command:
git remote add upstream https://github.com/PowerShellOrg/DSC.git
If you wish to check for any updated in the upstream version then we can simply issue the command:
git fetch upstream
This will not affect your working copy; instead, it will create a branch called upsteam\master. You will quite likely want to merge in any changes from the upstream copy to your active copy by using the command:
get merge upstream/master
Your Working Changes
With a working copy that is up-to-date with the latest versions from the upstream, you can begin editing your clone. As you proceed with the edits and creation of new resources you will want to update your repository with the latest versions with the following:
git push origin master
This command tells Git to push the current work to the repository called Origin, which we know is our personal copy. The branch we are working on is by default the master branch. If you added or removed files, you will need to update Git to reflect these changes using Git add, Git delete, and Git commit.
Pulling in Changes
That’s all there is to this. When you are ready to share your work back to the main repository all you need to do is use the Web interface to request a “Pull.” The option is located on the right action pane. From there you will work with the repository maintainer to explain what changes you have made, why you are sharing these, and then merge your copy into the main distribution.