A learning guide to get you started with PowerShell DSC.
About This Book
- Create flexible and maintainable deployments using DSC configuration scripts that stand the test of time.
- Explore the core architecture, concepts, and practices in depth.
- Learning PowerShell DSC is a step-by-step guide that shows you how to start using and taking advantage of PowerShell DSC along with configuring and deploying applications.
Who This Book Is For
If you are a system administrator, developer, or engineer and are responsible for configuration management and automation, then this book is for you. IT professionals who wish to learn PowerShell Desired State Configuration for the efficient management, configuration, and deployment of systems will also find this book useful.
What You Will Learn
- Explore PowerShell Desired State Configuration and activities around it, including the need for configuration management and abstraction.
- Create reusable DSC configurations and debug/ troubleshoot configuration files.
- Learn about the PowerShell DSC architecture with the help of push-and-pull management and workflows.
- Define DSC configuration scripts and data files and push DSC configuration files remotely and locally.
- Validate DSC Pull Server install and register target nodes with a DSC Pull Server.
- Learn about DSC Cross Platform and install PowerShell on Linux and macOS along with real-life DSC uses and different types of deployment.
The main goal of this book is to teach you to configure, deploy, and manage your system using the new features of PowerShell v5/v6 DSC.
This book begins with the basics of PowerShell Desired State Configuration, covering its architecture and components. It familiarizes you with the set of Windows PowerShell language extensions and new Windows PowerShell commands that make up DSC. Then it helps you create DSC custom resources and work with DSC configurations with the help of practical examples. Finally, it describes how to deploy configuration data using PowerShell DSC. Throughout this book, we will be focusing on concepts such as building configurations with parameters, the local configuration manager, and testing and restoring configurations using PowerShell DSC.
By the end of the book, you will be able to deploy a real-world application end-to-end and will be familiar enough with the powerful Desired State Configuration platform to achieve continuous delivery and efficiently and easily manage and deploy data for systems.
Style and approach
The purpose of this book is to introduce readers to the powerful PowerShell Desired State Configuration platform to achieve continuous delivery, efficient management, and the easy deployment of data for systems.
Table of Contents
Introducing PowerShell DSC
- What is PowerShell DSC?
- Why do we need configuration management?
- DSC quick wins
- DSC high-level overview
- Why all the abstraction?
- How does DSC help?
- DSC features
- PowerShell V4 DSC
PowerShell V5 DSC
- V5 DSC language extensions
- V5 DSC base resources
- V5 DSC cmdlets
- The PowerShell ISE
- Partial configurations and dependencies
- Class-based DSC resources
- DSC built-in support for help
- DSC run as credential support
- DSC resource side-by-side installation
- DSC resource script debugging
- Separation of node and configuration IDs
- DSC LCM MetaConfig updates
- DSC LCM rich state information
- DSC LCM RefreshMode values
- DSC status from a central location
- PowerShell V6 DSC
- Push and pull modes
- The general workflow
- The example workflow
- Configuration data
- Local Configuration Manager
- The DSC pull server
- Deployment considerations
DSC Configuration Files
- Defining a DSC configuration script file
- Defining a DSC configuration data file
- Creating reusable DSC configurations
Debugging and troubleshooting configuration script files
- Status at a glance
- Using DSC event logs
- Using the xDscDiagnostics module to analyze DSC logs
- Resetting the DSC engine cache
- Enabling the debug mode
- Fixing a stuck DSC run
What are DSC resources?
- What makes a good DSC resource
Creating PowerShell MOF-based custom DSC resources
- MOF-based DSC resource folder structure
- MOF-based DSC resource syntax
- The DSC PowerShell module file
- Authoring custom DSC resources
- Creating PowerShell class-based custom DSC resources
- Creating single-instance custom DSC resources
- Creating PowerShell custom DSC resources in C#
- Testing custom DSC resources
How do you find DSC resources?
- Microsoft DSC resource Kits
- Microsoft PowerShell DSC GitHub repository
- Microsoft PowerShell Gallery
- Custom hosting options
- Deploying DSC resources
- What are DSC resources?
Pushing DSC Configurations
- Setting things up
- Locally pushing DSC configurations
- Remotely pushing DSC configurations
- Things you must consider when pushing DSC configurations
Pulling DSC Configurations
Creating DSC pull servers
- DSC pull server setup considerations
- Initial setup tasks
- Creating an SMB DSC pull server
- Creating an HTTPS DSC pull server
- DSC pull server and registration keys
- Validating a DSC pull server install
- Registering target nodes with a DSC pull server
- Pulling DSC configurations with a DSC pull server
DSC pull server and target node status
- Checking the current LCM configuration status
- Triggering a DSC configuration to run on a target node
- Using DSC logging to check on the status
- Reporting on the target node status
- Reporting on the target node status with the DSC pull server
- Creating DSC pull servers
- DSC Cross Platform Support
- Example Scenarios
- Title: Learning PowerShell DSC - Second Edition
- Release date: September 2017
- Publisher(s): Packt Publishing
- ISBN: 9781787287242