PowerShell v4 Desired State Configuration
Click here to load reader
-
Upload
jason-stangroome -
Category
Technology
-
view
896 -
download
2
description
Transcript of PowerShell v4 Desired State Configuration
PowerShell v4
Desired State Configuration
Windows does not work that way!
•Win32 API•COM•WMI•.NET
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
PowerShell Desired State Configuration is …• New language KeywordsKeywords to declaratively define ConfigurationsConfigurations• Configurations that compile to Managed Object Format (MOF)• DSC Providers DSC Providers to apply Configurations to ResourcesResources• New Cmdlets Cmdlets to test, apply, and restore Configurations on demand• Local Configuration Manager Local Configuration Manager to maintain config and PullPull updates• DSC Service DSC Service to host Configurations and Providers centrally for Pull• Available in-the-box with Windows Server 2012 R2 on October 18th
Built-in Resources include …
•Archive• Environment• File•Group• Log•Package
•WindowsProcess•Registry•WindowsFeature• Script• Service•User
Configuration DemoConfig {param (…)
Node localhost {
WindowsFeature Telnet {Ensure = 'Present' # or 'Absent'Name = 'Telnet-Client'
}}
}
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 { … };
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
PS /> Start-DscConfiguration
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
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
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
With DSC, Windows becomes text files•Versionable• Indexable•Auditable• Self-documenting
Without DSC, follow the same principals• Idempotency• Separate intent from implementation• Separate environmental configuration differences• Server names• Credentials• Number machines per role
Jason Stangroome@jstangroome
blog.stangroome.com