Skip to content

Commit 4f440d5

Browse files
committed
Merge pull request #72 from zjalexander/master
merging in changes, will take feedback post-merge.
2 parents 57e31e7 + d970c40 commit 4f440d5

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

dsc/decisionMaker.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Desired State Configuration Overview for Decision Makers #
2+
3+
This document describes the business benefits of using PowerShell Desired State Configuration (DSC). It is not a technical guide.
4+
5+
## What Is Desired State Configuration? ##
6+
7+
Windows PowerShell Desired State Configuration (DSC) provides a configuration platform built into Windows that is based on open standards. DSC is flexible enough to function reliably and consistently in each stage of the deployment lifecycle (development, test, pre-production, production), as well as during scale-out.
8+
9+
DSC centers around the idea of "[configurations](https://msdn.microsoft.com/en-us/powershell/dsc/configurations)", which are easy-to-read documents that describe an environment made up of computers ("nodes") with specific characteristics. These characteristics can be as simple as ensuring a specific Windows feature is enabled, or as complex as deploying SharePoint.
10+
11+
DSC also has monitoring and reporting built in. If a system is no longer compliant, DSC can raise an alert and act to correct the system.
12+
13+
## Benefits of Using Desired State Configuration ##
14+
15+
Configurations are designed to be easily read, stored, and updated. Configurations simply declare the state target devices should be in, instead of writing instructions for how to put them in that state. This makes it much less costly for to learn, adopt, implement, and maintain configuration through DSC.
16+
17+
Creating configurations means that complex deployment steps are captured as a "single source of truth" in a single location. This makes repeated deployments of a specific set of machines much less error-prone. In turn, this makes deployments faster and more reliable. This enables quick turnaround on complex deployments.
18+
19+
Configurations are also shareable via the PowerShell gallery. This means common scenarios and best practices might already exist for the work you need done.
20+
21+
22+
## Desired State Configuration and DevOps ##
23+
24+
[DevOps](http://blogs.technet.com/b/ashleymcglone/archive/2015/11/20/devops-for-n00bs-ie-windows-people.aspx) is a combination of people, technologies and culture that allow for rapid deployment and iteration. DSC was designed with DevOps in mind. Having a single configuration define an environment means that developers can encode their requirements into a configuration, check that configuration into source control, and operations teams can easily deploy code without having to go through error-prone manual processes.
25+
26+
Configurations are also [data-driven](https://msdn.microsoft.com/en-us/powershell/dsc/configdata), which makes it easier for ops teams to identify and change environments without developer intervention.
27+
28+
## Desired State Configuration On and Off Premise ##
29+
30+
DSC can be used to manage both on-premise and off-premise deployments. For on-premise solutions, Desired State Configuration has a [pull server](https://msdn.microsoft.com/en-us/powershell/dsc/pullserver) that can be used to centralize management of machines and report on their status. For cloud solutions, Desired State Configuration is usable wherever Windows is usable. There are also specific offerings from Azure built on Desired State Configuration, such as [Azure Automation](https://azure.microsoft.com/en-us/documentation/services/automation/), which centralizes reporting of Desired State Configuration.
31+
32+
## DSC and Compatibility ##
33+
34+
Although DSC was introduced in Windows Server 2012 R2, it is available for downlevel operating systems via the Windows Management Framework (WMF) package. More information about the WMF can be found on the [PowerShell landing page](https://msdn.microsoft.com/en-us/powershell/).
35+
36+
DSC can also be used to manage Linux. For more information, see [Getting Started with DSC for Linux](https://msdn.microsoft.com/en-us/powershell/dsc/lnxgettingstarted)

dsc/gettingStarted.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Getting Started with PowerShell Desired State Configuration #
2+
3+
This guide describes how to begin creating PowerShell Desired State Configuration documents and apply them to machines. It assumes basic familiarity with PowerShell cmdlets, modules, and functions.
4+
5+
6+
## Create a Configuration ##
7+
8+
[**Configurations**](https://msdn.microsoft.com/en-us/powershell/dsc/configurations) are documents that describe an environment. Environments consist of "**nodes**", which are commonly virtual or physical machines.
9+
10+
Configurations can come in a variety of forms. The easiest way to create a new configuration is to create a .ps1 (PowerShell script) file. To do this, open your editor of choice. The PowerShell ISE is a good choice, since it understands DSC natively. Save the following as a PS1:
11+
12+
```powershell
13+
configuration myFirstConfiguration
14+
{
15+
import-dscresource -name WindowsFeature
16+
17+
Node localhost
18+
{
19+
WindowsFeature IIS
20+
{
21+
Name = "IIS"
22+
23+
}
24+
25+
}
26+
27+
}
28+
```
29+
## Parts of a Configuration ##
30+
**Configuration** is a keyword that has been added to PowerShell 4.0. It signifies a special kind of PowerShell function used by Desired State Configuration. In this example, the function is named myFirstConfiguration.
31+
32+
The next line is a import statement, similar to importing a module. It will be discussed later on.
33+
34+
"Node" defines the machine name this configuration will act on. Although this configuration is edited locally, configurations can reach out to remote nodes and configure them.
35+
36+
Nodes can be machine names or IP addresses. You can have multiple nodes in a single configuration document. Using [configuration data](https://msdn.microsoft.com/en-us/powershell/dsc/configdata), you can also have the same configuration apply to multiple nodes. In this case, the node is "localhost" - which means the local computer.
37+
38+
The next item is a [**resource**](https://msdn.microsoft.com/en-us/powershell/dsc/resources). Resources are building blocks of configurations. Each resource is a module that defines the implementation logic of a single aspect of a machine. You can view every resource on your machine by running **Get-DscResource** in PowerShell. Resources must be present on the local machine and imported before they can be used in a configuration with **Import-DscResource** which is on the second line of this configuration.
39+
40+
**Enacting a Configuration**
41+
42+
If the script above is saved and run, no output will be produced. This is because a configuration is just a function, and the script above has defined the function but not yet run it. After the function is defined, it must be invoked:
43+
```powershell
44+
myFirstConfiguration
45+
```
46+
47+
When executed, configuration functions validate the configuration is valid. It should have no syntax errors, resources should have all mandatory parameters defined, and all resources should be imported before execution.
48+
49+
Once the configuration is executed, it creates a folder with the name of the configuration containing a **.MOF file** for every node in the configuration. The .MOF file is a standards-based management format which is used by PowerShell DSC to communicate over the network.
50+
51+
To enact the configuration:
52+
```powershell
53+
Start-DscConfiguration -path ./myFirstConfiguration
54+
```
55+
This creates a PowerShell job that reaches out to the nodes in the configuration and configures them. To see the output of the job, use -wait.
56+
```powershell
57+
Start-DscConfiguration -path ./myFirstConfiguration -wait
58+
```
59+

0 commit comments

Comments
 (0)