Desired State Configuration

PowerShell DSC
The future of deployments by Rami Mounla
Today’s outline
•
•
•
•
About myself
Learn about DSC
Look at DSC in action
Check the DSC CRM configuration
About myself
•
Solution Architect
•
Lead of the Dynamics CRM Team
•
MCP – MCSD – MCTS
•
Dynamics CRM MVP
Who are you?
Industry Maturity Model
Deployments Characteristics
Predictable
Repeatable
Fast
Automated
No Human
Previous Experience
1 ½ days
Platform
1 day
SQL
½ day
½ day
Prerequisites
AD
½ day
Firewall
1 day
VM
Environment Drift
PowerShell - Desired State Configuration
What is DSC
management platform in Windows PowerShell that
enables deploying and managing configuration data for
software services and managing the environment in which
“DSC is a new
these services run”
What Does DSC provide?
PowerShell language extensions,
new Windows PowerShell cmdlets, and resources that you can use
to declaratively specify how you want your software environment to be
“DSC provides a set of Windows
configured.”
What are the advantages?
•
Avoid configuration drift
•
Keep configurations the same for all servers (all environments)
•
Easily create VMs from scratch for every deploy
•
On-premise or cloud (e.g. Azure)
So what?
•
Increase the (on going) assurance that deployment will succeed
•
Faster Deployments
•
Automate and simplify our deployments
How does it work?
•
Authoring Phase: Create Configuration PowerShell
•
Staging Phase: Create MOF file
•
Apply the configuration to the server
• Push
• Start-DscConfiguration
• Pull
• OData services to pull the details
•
Runs as System User
MAKE IT SO!
Architecture
DSC Cocktails
Providers
Provider
Description
DSC Archive Resource
Unpacks archive (.zip) files at specific paths on target nodes.
DSC Environment Resource
Manages system environment variables on target nodes.
DSC File Resource
Manages files and directories on target nodes.
DSC Group Resource
Manages local groups on target nodes.
DSC Log Resource
Logs configuration messages.
DSC Package Resource
Installs and manages packages, such as Windows Installer and setup.exe packages, on target nodes.
DSC WindowsProcess Resource
Configures Windows processes on target nodes.
DSC Registry Resource
Manages registry keys and values on target nodes.
DSC WindowsFeature Resource
Adds or removes Windows features and roles on target nodes.
DSC Script Resource
Runs Windows PowerShell script blocks on target nodes.
DSC Service Resource
Manages services on target nodes.
DSC User Resource
Manages local user accounts on target nodes.
156 Other Providers
xPendingReboot
Checks to see if a reboot is pending and
allows DSC to predictably handle the
condition
xSmbShare
Allow's configuration of a SMB Share
xADDomain
Allows configuration of Active Directory
components
xChrome
Installs the Chrome browser
xUAC
Allows configuration of User Account
Control prompt.
xWindowsUpdate
Handles installation of a Windows
update (or a hotfix) from a given path
(file path or a URI)
xFirewall
Manage firewall rules
https://gallery.technet.microsoft.com/scriptcenter/DSC-Resource-Kit-All-c449312d
Demo
Resource example & Diff
Prerequisites
•
Windows Management Framework (WMF) 4.0
•
PowerShell 4.0 with remoting enable
•
.NET 4.5
•
Preferably 2012 R2 or 8.1
•
Patch KB2883200 (for eXperimental resources)
CRM 2015 perquisites
•
•
•
AD
OU
Service Account
• Access to Performance Log Users group
•
SQL (with specific config)
• .NET 3.5
•
•
•
.NET 4.5.2
Installation account must be Domain account
Cannot run using remoting
Typical CRM deploy: UI
Typical CRM deploy: Scripted Deploy
<CRMSetup>
<Server>
<Patch update="true"> </Patch>
<LicenseKey>****</LicenseKey>
<SqlServer>WIN-FJSSHT6JGM6</SqlServer>
<Database create="true"/>
<Reporting URL="http://WIN-FJSSHT6JGM6/ReportServer"/>
<OrganizationCollation>Latin1_General_CI_AI</OrganizationCollation>
<basecurrency isocurrencycode="NZD" currencyname="New Zealand Dollar" currencysymbol="$" currencyprecision="2"/>
<Organization>CRM 2015 Organisation</Organization>
<OrganizationUniqueName>CRM2015Org</OrganizationUniqueName>
<OU>OU=DynamicsCrmOu,DC=TheAuthority,DC=local</OU>
<WebsiteUrl create="true" port="5555"> </WebsiteUrl>
<InstallDir>c:\Program Files\Microsoft Dynamics CRM</InstallDir>
...
<SQM optin="false"/>
<muoptin optin="true"/>
<Email>
<IncomingExchangeServer name=""/>
</Email>
</Server>
</CRMSetup>
Command line
E:\Server\amd64\SetupServer.exe
/Q /l C:\deployment\crmserver_install.log
/config C:\deployment\crmConfigurationFile2015.xml
Demo
CRM using DSC
Your Turn…
Resources
Continuous Delivery by Jez Humble, David Darley
a Martin Fowler Signature book
•
•
•
•
http://bit.ly/1abB8PD (good place to start)
http://bit.ly/1TNqIqs (PluralSight course)
http://bit.ly/1MEGQGz (Microsoft Providers)
http://bit.ly/1xmaVFV (eXperimantal Resources)
Questions?