Desired State Configuration in Windows PowerShellKenneth HansenJeffrey Snover
MDC-B302
Monad Manifesto*1. Monad Automation Model (v1)2. Monad Shell (v1)3. Monad Remote Scripting (v2)4. Monad Management Console (v3)5. Monad Management Models (v4)
* http://www.jsnover.com/Docs/MonadManifesto.pdf
Make It So
(@#$%@$&)Yes Sir!
The Good and the BadScale means…Business is growing!!
However… More servers=> More Failures
Scale * ComplexityExceeds Skill
Rapid change means…Can respond and capture market
However…More Change=> More Failures
Change isPrimary cause of outage
Life in the Cloud… (management)
Rapid change, at scale with, constant failures
What everyone wants…
Continuous service availability +Continuous rapid release cycle +
Continuous deployment_________Automation
$$IdeaBusiness Development Operations
What is DSC?
Enables you to ensure that the components of your data center have the correct configuration
Allows “continuous deployment” and prevents “configuration drift”
Uses language extensions and providers to enable declarative, autonomous and idempotent (repeatable) Deployment, Configuration and Conformance of standards-based managed elements
PowerShell Desired State Configuration
Configuration and Continuous DeploymentIntent Environment
Configuration(Dev -> Test -> Production)
$SystemDrive = "C:"$DemoFolder = "$SystemDrive\Demo"$global:WebServerCount = 3…
Structural Configuration
WindowsFeature IIS { Name = "Web-Server" Ensure = "Present"}…
Make It So Idempotent Automation
foreach -parallel ($featureName in $Name){ $feature = Get-WindowsFeature -Name $featureName if(($Ensure -eq "Present") -and (!$feature.Installed)) { Install-WindowsFeature -Name $featureName } ….}…
Push Model
Configuration Staging Area(Contains DSC
data)3rd party
languages and tools
Authoring Phase(May include imperative as well as declarative code)
Staging Phase- Fully declarative
configuration representation using DMTF standard MOF instances
- Configuration is calculated for all nodes
PS V1, V2, V3
PS V4***
“Make it So” Phase(Declarative configuration is reified through imperative providers.)
Parser and Dispatcher
Imperative Providers
*** When authoring in PowerShell, on top of PSV3 imperative features, PSV4 adds:
• Declarative syntax extensions• Schema-driven Intellisense• Schema validation (early-binding)
Providers implement changes:• Monotonic• Imperative• Idempotent
Local Configuration
Store
Pull Model
Pull Server(Contains DSC data
and Modules)
Authoring Phase(May include imperative as well as declarative code)
Staging Phase- Fully declarative
configuration representation using DMTF standard MOF instances
- Configuration is calculated for all nodes
“Make it So” Phase(Declarative configuration is reified through imperative providers.)
Parser and Dispatcher
Imperative Providers
*** When authoring in PowerShell, on top of PSV3 imperative features, PSV4 adds:
• Declarative syntax extensions• Schema-driven Intellisense• Schema validation (early-binding)
Providers implement changes:• Monotonic• Imperative• Idempotent
Local Configuration
Store
3rd party languages and tools
PS V1, V2, V3
PS V4***
How does this relate?• System Center Configuration Manager
A management solution with extensible features focused on configuring the Enterprise on-premise compute. By contrast PowerShell DSC is a platform technology focused on the Cloud (servers and standard-based devices) helping to bridge development and operations.
• System Center Virtual Machine ManagerSCVMM is a fabric controller that manages hypervisors, network and storage; creating, managing and configuring VMs and Services. SCVMM Service Model can call DSC during provisioning. SCVMM Service Model and the new Cloud OS Virtual Machine Role can leverage DSC for configuration.
• Windows PowerShellThe automation language and platform for Windows and standards-based devices. Extensively leveraged across Windows, Microsoft and the industry.• We are substantially increasing the Cloud OS capabilities of Windows Server by
adding Desired State Configuration to the base platform via PowerShell.• Overtime, just as with PowerShell original, we expect strong leverage of the
platform, making a fully integrated, better together story.
Directly Related at TechEd• DEV-B312
• DevOps: Increasing Application Lifecycle Efficiencies with Microsoft Visual Studio and System Center
• June 26th 5:00pm-6:15pm.
• MDC-IL206• Desired State Configuration with Windows Server 2012 R2 • June 26th 10:15am – 11:30am
Desired State Configuration…
• Simplify configuration• Enable continuous deployment• Prevent configuration drift• Create an ecosystem
Thank You!
Make It So
(@#$%@$&)Yes Sir!
Backup Slides
What Started the DSC Trend??
• Declarative languages have been around a long time (Prolog 1970s )
• Cloud => Rapid Change at Scale with Constant Failure• Forces automation• Birthed DevOps• Encourages DSC
PowerShell DSC (V1)
• Declarative Configuration Syntax in PowerShell Language
• Local Configuration Manager• Receives MOF documents declaring desired state of Node• Downloads and invokes idempotent resources to reify (make it so)
• Simple “Pull Server”• Leverages and Creates an Ecosystem
FAQ –…
• Why add DSC to PowerShell instead of standalone?
• What is the focus of PowerShell DSC?• How does DSC relate to
Puppet/Chef/CFEngine? Vagrant?• How does DSC relate to SCCM?• How does DSC relate to SCVMM?• How does DSC relate to Azure service
templates?
Observations
• Need a language to express desired state easily
• Need components with associated properties (Types)
• Need an agent to “Make It So”• Note: Nothing said about “How”• Declarative vs Imperative
• Need Idempotence (repeatable)• Need both Push Model and Pull Model• Want to compare Actual and Expected
States
Desired State Configuration Management
Configuration management (CM) is the detailed recording and updating of information that describes an enterprise's hardware and software. It is a process for establishing and maintaining consistency of a product's performance, functional and physical attributes with its requirements, design and operational information throughout its life. MIL-HDBK-61A, ""Military Handbook: Configuration Management Guidance". Department of Defense. 07-February-2001.
Expression of Configuration• Custom configuration is typically done using imperative
scripts:• Regardless of how powerful the language, the author is still
required to specify each and every action to perform along with all the error handling, logging, etc.
• Level of detail makes imperative scripts complex to develop and hard to document and maintain
• Hard to make these scripts really reliable• DSC languages use declarative scripting techniques
• Much less powerful than general-purpose imperative programming languages
• Contrained to expressing state in the domain systems configuration
• They (typically) express the desired end state of the system , but (mostly) not how to get to that state.
• Are idempotent and monotonic i.e. no matter how many times you run them, they always bring the system to the same final state
DevOps• http://en.wikipedia.org/
wiki/DevOps:
"DevOps" is an emerging set of principles, methods and practices for communication, collaboration and integration between software development (application/software engineering) and IT operations (systems administration/infrastructure) professionals
Why does this matter? Agile development techniques lead to rapid release
cycles Ops needs continuous integration and
deployment to roll out rapid changes robustly.<Where DSC and Automation have a strong role!>
Components• PowerShell Language Extensions
• Used by DevOps / Operations to define and generate configuration doc, then deploy to and manage configuration for managed nodes
• MOF Instance doc• Configuration document that is delivered to managed nodes
• WMI Service• A rich, high-performance, standards-based management stack that is suitable for a wide range of management
applications.
• Local Configuration Store• File system storage of pending, current and previous configuration
• Local Configuration Manager (LCM)• Component on the managed node that coordinates the reception and application of configuration data for that
node.
• Configuration Agent (CA)• Component that interprets configuration data and enacts any changes needed to bring the physical system state
into alignment with the expressed configuration.
• Resource Provider• Process configuration for a single resource. i.e.: Network Card, Disk, etc.
Demo
Name
Track resourcesLearn more about Windows Server 2012 R2 Preview, download the datasheet and evaluation bits on http://aka.ms/WS2012R2Learn more about System Center 2012 R2 Preview, download the datasheet and evaluation bits on http://aka.ms/SC2012R2
msdn
Resources for Developers
http://microsoft.com/msdn
Learning
Microsoft Certification & Training Resources
www.microsoft.com/learning
TechNet
Resources
Sessions on Demand
http://channel9.msdn.com/Events/TechEd
Resources for IT Professionals
http://microsoft.com/technet
Evaluate this session
Scan this QR code to evaluate this session.
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.