Power Shell and DSC Empowers Dev Ops and












































- Slides: 44
Power. Shell and DSC Empowers Dev. Ops and the Cloud Dan Stolts (@ITPro. Guru) Chief Technology Strategist US DX North East – Audience aka. ms/70 -534 -book Blog: ITPro. Guru. com dstolts@Microsoft. com www. linkedin. com/in/danstolts Specializations: Cloud, Virtualization, Windows Server @ITPro. Guru
https: //puppetlabs. com/ @ITPro. Guru
Outperforming teams are a l col 54 % extensively more likely to with co 40% te ra bo their 41% un te … of development budgets for software, IT staff and external professional services will be consumed by poor requirements rp ar Collaboration blockers ts … of implementations end up getting reworked because they don’t meet the users’ original requirements IT drives business success! High IT performance correlates with strong business performance, helps boost productivity, market share and profit. 80 % failure rate … … for companies that try to adapt their existing tools for Dev. Ops practices 26. 7% No executive support 56. 7% Cultural inhibitors 43. 3% Fragmented processes 70 % Developers 3/4 of 1 in 6 of teams IT Ops IT decision makers is still unfamiliar with the term Dev. Ops Would increase risk to reduce IT costs Business have adopted Agile methodologies The average hourly cost of infrastructure failure is $100, 000 per hour dual goals It takes on average 200 minutes to diagnose and repair a production issue and accelerate business agility Dev. Ops was being initiated by more development teams than IT Ops teams by about a 40% to 33% margin Responding to ongoing needs for efficiency and growth CIOs Always keeping all systems safe and secure A bug caught in production ends up costing 100 x more than if the same bug was found @ITPro. Guru earlier in the development cycle
• • • http: //www. itproguy. com/devops-practices/ • • •
Why DSC VS GP? (Better than GP)
Power. Shell Command-Line Tool for Azure https: //azure. microsoft. com/downloads/
Windows Management Framework 5. 0 Updates… • Just Enough Administration (JEA) • Creating Custom Types using Power. Shell Classes • Improvements in Power. Shell Script Debugging • Improvements in Desired State Configuration (DSC) • Audit Power. Shell Usage using Transcription and Logging • Software Discovery, Install and Inventory with Package. Management • Power. Shell Module Discovery, Install and Inventory with Power. Shell. Get • Power. Shell Script Discovery, Install and Management with Power. Shell. Get • • • New and updated cmdlets based on community feedback Information Stream Generate Power. Shell Cmdlets based on OData Endpoint Network Switch Management with Power. Shell Software Inventory Logging (SIL) https: //www. microsoft. com/en-us/download/details. aspx? id=50395
DSC Resource Kit – Anniversary Release • • • x. Fail. Over. Cluster x. Firefox x. Networking x. Php x. PSDesired. State. Configuration x. Robocopy x. Sql. Ps x. SQLServer x. Storage x. Time. Zone x. Web. Deploy x. Windows. Update To see a list of all released DSC Resource Kit modules, go to the Power. Shell Gallery http: //www. powershellgallery. com/ … display all modules tagged as DSCResource. Kit. You can also enter a module’s name in the search box in the upper right corner of the Power. Shell Gallery to find a specific module. # To list all modules (WMF 5. 0)of the DSC Resource Kit Find-Module -Tag DSCResource. Kit # To list all DSC resources (WMF 5. 0) from all sources Find-Dsc. Resource https: //blogs. msdn. microsoft. com/powershell/2016/05/18/dsc-resource-kit-anniversary-release/
Tip: Must Read Book Amazon… The Phoenix Project: A Novel about IT, Dev. Ops, and Helping Your Business Win Paperback – October 16, 2014 The book is available on Audio Book; you can likely get it for free - if it’s your first time accepting a book from a friend. http: //a. co/f. JXE 92 A. If you do not have an Audible Account, you get two free books when signing up for your free account. @ITPro. Guru This is the BEST IT Book I have ever read.
§ Gene Kim’s “ 3 ways” § § Infrastructure as Code (Ia. C) § Continuous Integration (CI) § Automated Testing § Application Performance Monitoring/Management (APM) § § Release Management § Configuration Management § § Advanced Monitoring Capacity Management Feature Flags • • • § • Hypothesis Driven Development • • Testing in Production Fault Injection A/B Testing http: //www. itproguy. com/devops-practices/ http: //itrevolution. com/the-three-ways-principles-underpinning-devops/ @ITPro. Guru
Traditional vs modern dev-ops Category Traditional Modern Dev. Ops Quality of code check-ins Unknown Validated through unit tests Environment Creation/Configuration Manual Automated Deployment Frequency 1 -2 months (or less frequent) Deploy whenever needed, including several per day App Deployment Process Requires meetings and planning Push-button deployment Deployment validation Manual Automated Monitoring Minimal to none Health and Performance monitoring Dev and Ops relationship Blame culture Culture of trust @ITPro. Guru
DSC – Definition “Standard Space management to manage heterogeneous networks containing different types of Servers connected with Clients of different form factors. ” Servers • Windows/Linux etc. Clients • Windows/i. OS etc Form Factors • PC/Servers/Tablet/Phones etc.
Why DSC? Life with non. Registered (mobile) Devices Different (including non-Windows) type of devices needs to be handled Life in the Cloud… Rapid change, at scale with, constant failures Requirement Need of an agent to “Make It So” Want to compare Actual and Expected States easily Need a language to express custom desired state easily
What is “Make it so”? • With DSC we just define in configuration – “Hey, you are a web browser, this is what you should look like. Get to it, stay that way. ” • Logic of making configuration in that way lies with ‘Local Configuration Manager’ on Client Machines. • Making logic on client side enable us to control device specific behavior implementation
How DSC help? One Stop Solution to Manage Enterprise Cloud BYOD - non -Win Devices Laptop (VPNs) Desktop/ Server Option of correcting configuration drift when it occurs, or just report on configuration drift, to ley it know to admins that it has occurred
How DSC help? One Stop Solution to Manage Enterprise Cloud BYOD - non -Win Devices Laptop (VPNs) Desktop/ Server Allows you to describe the desired state of your environment by using this new power shell syntax Option of correcting configuration drift when it occurs, or just report on configuration drift, to ley it know to admins that it has occurred
How DSC help? One Stop Solution to Manage Enterprise Cloud BYOD - non -Win Devices Laptop (VPNs) Desktop/ Server Allows you to describe the desired state of your environment by using this new power shell syntax Option of correcting configuration drift when it occurs, or just report on configuration drift, to ley it know to admins that it has occurred
Where DSC can be used? Install or remove server roles and features Manage registry settings Manage files and directories Start, stop, and manage processes and services Already Supported in GP Manage local groups and user accounts Install and manage packages such as. msi and. exe Manage environment variables Discovering the actual configuration state on a given node Fix a configuration that has drifted away from the desired state
How DSC works? 3 Phase Model Authorizing Phase “Make It So” Phase Staging Phase
How DSC works? Authoring Phase In this phase Admin creates the DSC configuration locally, through Power. Shell or by third party languages/tools. The output is one or more MOF (Management Object Format) files, the format which is consumable by DSC.
How DSC works? DC / Pull Server Authoring Phase Staging Phase In this phase DSC data (MOF files) is staged for Deployment – • Push Model – On DC • Pull Model – Dedicated Web Server (IIS)
DSC data is either pulled or pushed to the “Local Configuration Store” and contains the current, previous and the desired (DSC) state configuration. How DSC works? DC / Pull Server Authoring Phase Staging Phase “Make it So” Phase Enterprise The configuration then gets parsed and the relevant (WMI) provider implements the change and “makes it so”.
Power Shell Extension • Support type definitions for eg. Configuration types • New language/constructs specific to authoring of the Configuration scripts. Eg. configuration My. Website { node ("Web. Server 1", "Web. Server 2") { Windows. Feature IIS { Ensure = "Present" Name = "Web-Server“ } } } @ITPro. Guru
As Dan the developer, I can easily author a DSC script reusing DSC resources from a public or private gallery, so that I can quickly and easily write DSC scripts with very little custom code.
Author a DSC script WITHOUT DSC Resource
… reusing DSC resource/s - I I can Find DSC resources from Gallery by Search Term/Name/Tag I have a rich set of resources to use from Day 1 that replace my RM actions [see next slide]
Rich set of DSC resources replacing RM actions No. 1 RM Tool Application Pool Tag IIS RM Action Create/Config/Start/Remove App Pool RM Customer Usage 1. Very Frequent 2 Web Application IIS Create/Configure/Remove Web Application 1. Very Frequent Web. Deploy 3 Website IIS Create/Configure/Remove/Start/Stop/Restart Website 1. Very Frequent Website 4 Database Deployer SQL Create/Drop Database 1. Very Frequent SQLQuery 5 Database Deployer SQL Execute SQL Script 1. Very Frequent SQLQuery 6 Windows System Common Windows IO 1. Very Frequent File 7 XCopy Deployer System Copy File or Folder 1. Very Frequent File 8 9 MSI Deployer Virtual Directory System Deploy MSI IIS Create/Configure/Remove Virtual Directory 1. Very Frequent 2. Frequent Package IISWeb. Configuration 10 Web Application IIS 2. Frequent Web. Deploy 11 File System Create/Delete File or Folder 2. Frequent File 12 Command Line Runner System Run Command Line [as User] 2. Frequent Process 13 Windows Services Manager System Create/Start/Stop/Config/Restart Service 2. Frequent Service 14 MTM Automated Tests Manager Test 2. Frequent ? Remove Web Application Run Tests Analog DSC Resource IISWeb. Configuration
Existing PS Modules/DSC resources ported to gallery I can port PS modules & DSC resources from Technet Script center to the gallery.
reusing DSC resource/s - II WITH DSC Resource I can install multiple resources & modules that my DSC script depends on before deploying to a node in push mode.
Power. Shell Gallery http: //www. powershellgallery. com/
… from a public or private gallery - I I can install DSC resources from the Gallery
… from a public or private gallery - II I can choose the URI of the public/private gallery or the path [like a build drop path] that I want to install the module from.
… from a public or private gallery - III User can choose to not install module from the public/private gallery but to directly copy all the required bits directly from a build drop path.
What does a Script look like? “My. Configuration. webserver” Configuration Block… Resource Block… (AKA: Compilation Job) Within a Configuration block, you can do anything that you Node block… normally could in a Power. Shell function https: //azure. microsoft. com/en-us/documentation/articles/automation-dsc-overview/
DSC configuration Step-by-Step Save the file as Test. Config. ps 1. Prerequisites • An Azure Automation account. see Azure Run As Account. • An Azure Resource Manager VM (not Classic) running Windows Server 2008 R 2 or later. see Create your first Windows virtual machine in the Azure portal • Prerequisites (above) • Create Test Config • Importing a configuration into Azure Automation • Viewing Configuration • Compile Configuration (MOF file) • Viewing a compilation • Viewing Node Configuration • Onboard Azure ARM VM for Mgmt • Assign Node Configuration https: //azure. microsoft. com/en-us/documentation/articles/automation-dsc-getting-started/
Azure Automation DSC Life. Cycle
Session VS VM (or VDI) s, pp mt , A g OS ig, M nf CH d Co EA kloa or W S O e l s g d n a i S lo k r o W All M V e v d i s a s he O, , a M ver Disk I U, OS , O Disk, y, CP ensity ( r D o ) , s s m k Me ense wor Lic The Session Based Computing VM or VDI Based Computing @ITPro. Guru
Containers App App App App App App App App App s e Linux VM g a t n a & v d A VM n ead l l A of sio verh s tle o e S , Lit n o i at l o s Container Based Density Advantages I Container Based Computing VM Isolation rm App OS atfo l P CH EA S O e l s g d n a i S lo k r o App W All @ITPro. Guru
Container Run-time On-Premises Windows Server Container(s) Docker Container Hyper-V Container(s) Linux Virtual machine(s) Physical Server @ITPro. Guru
Container Run-time Cloud Azure Container(s) ACS … Containers As A Service Docker Container (Linux Now) Windows Coming Hyper-V Container(s) Windows Server Container(s) Virtual machine(s) Docker Compatible Linux Windows Cloud Provider @ITPro. Guru
Azure is an open cloud Clients Dev. Ops Management Applications Paa. S Orches tration App Frameworks & Tools Databases & Middleware Infrastructure @ITPro. Guru
aka. ms/devops aka. ms/iac_tlp aka. ms/devopsmva #Talk. Dev. Ops @ITPro. Guru
• • http: //sdmsoftware. com/group-policy-blog/group-policy-vs-desired-stateconfiguration-vs/ http: //blogs. msdn. com/b/powershell/archive/tags/desired+state+configuration/ @ITPro. Guru
§ § § http: //ITPro. Guru. com https: //msdn. microsoft. com/virtualization/windowscontainers http: //aka. ms/windowscontainers @ITPro. Guru












































