PowerShell Desired State Configuration (DSC) allows declaring configurations for resources using new keywords and compiling them to MOF files. DSC providers apply configurations to manage resources like files, registry keys, Windows features. The Local Configuration Manager maintains configurations and can pull updates. A DSC service hosts configurations and providers centrally for pull mode. Built-in resources include archive, environment, file and more. Configurations make Windows infrastructure declarative and versionable.
3. PowerShell is …
• .NET underneath
• Structured data and behaviours
• Objects in, objects out
• A dynamic COM client
• A WMI/CIM native
• … capable of text manipulation and Regular Expressions too
4. PowerShell Desired State Configuration
is …
• New language KeywordsKeywords to declaratively define ConfigurationsConfigurations
• Configurations that compile to Managed Object Format (MOF)
• DSC ProvidersDSC Providers to apply Configurations to ResourcesResources
• New CmdletsCmdlets to test, apply, and restore Configurations on demand
• Local Configuration ManagerLocal Configuration Manager to maintain config and PullPull updates
• DSC ServiceDSC Service to host Configurations and Providers centrally for Pull
• Available in-the-box with Windows Server 2012 R2 on October 18th
7. instance of MSFT_RoleResource as
$MSFT_RoleResource1ref
{
ResourceID = "[WindowsFeature]Telnet";
Ensure = "Present";
SourceInfo = "::6::9::WindowsFeature";
Name = "Telnet-Client";
ModuleName = "MSFT_RoleResource";
ModuleVersion = "1.0";
};
instance of OMI_ConfigurationDocument { … };
8. Local Configuration Manager
• Responsible for validating and applying configuration
• Runs under the context of the SYSTEM account
• Only Administrators can submit configuration
• Defaults to running in Push mode on a clean OS / PSv4 install
• Supports Pull mode via file share or web service
• Pull mode handles custom Resource Provider deployment
• A single MOF file must encompass all the configuration
10. DSC Service
• An IIS-hosted OData web service
• An optional feature in Server 2012 R2
• Consists of two components:
• The Pull Server
• The Compliance Server
• No documentation yet
11. Custom DSC Providers
• Custom Resources are a formalisation of the Script Resource:
• Get-TargetResource
• Set-TargetResource
• Test-TargetResource
• MOF Schema with a Key and properties
• Existing examples:
• DHCP (by @gpduck)
• Hosts file (on github.com/PowerShellOrg/DSC)
• Website (in the Hands-On Lab)
• Expect to develop custom resources as an early adopter
12. What about System Center?
• Configuration Manager is expected to be used by the
Enterprise. DSC is expected to be used for Azure and for
DevOps.
• Virtual Machine Manager 2012 R2 can call DSC during
provisioning
13. With DSC, Windows becomes text files
•Versionable
•Indexable
•Auditable
•Self-documenting
14. Without DSC, follow the same principals
• Idempotency
• Separate intent from implementation
• Separate environmental configuration differences
• Server names
• Credentials
• Number machines per role