This directory contains scripts to deploy and configure a complete lab environment for the DSC Workshop. The lab environment can be deployed to either Azure or Hyper-V.
The lab scripts create a fully functional environment with:
- Domain controller (DSCDC01)
- SQL Server (DSCCASQL01)
- DSC Pull Server with SQL backing (DSCPull01)
- Azure DevOps Server (DSCDO01)
- Hyper-V host for nested virtualization (DSCHost01)
- Multiple target nodes for DSC configuration (DSCFile01-03, DSCWeb01-03)
The numbered scripts follow a specific sequence for deploying and configuring the lab:
- Deploy the base lab (00, 10)
- Customize the environment (20)
- Configure Azure DevOps pipelines (31, 32)
- Add additional features (33, 40, 50)
| Script | Description |
|---|---|
| 00 Lab Deployment.ps1 | Main entry point that determines deployment type (Azure/Hyper-V) and calls all other scripts in sequence |
| 10 Azure Full Lab with DSC and AzureDevOps.ps1 | Deploys lab to Azure with all required VMs and configurations |
| 10 HyperV Full Lab with DSC and AzureDevOps.ps1 | Deploys lab to local Hyper-V with all required VMs and configurations |
| Script | Description |
|---|---|
| 20 Lab Customizations.ps1 | Performs post-deployment customizations, including installing required modules and software |
| 20 SoftwarePackages.psd1 | Configuration data for software packages to be installed in the lab |
| Script | Description |
|---|---|
| 31 New Release Pipeline DscConfig.Demo.ps1 | Creates Azure DevOps release pipeline for the DscConfig.Demo project |
| 32 New Release Pipeline DscWorkshop.ps1 | Creates Azure DevOps release pipeline for the main DscWorkshop project |
| Script | Description |
|---|---|
| 33 Install DscAutoOnboarding.ps1 | Installs and configures the DSC auto-onboarding feature |
| 40 SQL Server Reporting DB.ps1 | Sets up SQL Server Reporting Services with DSC reports |
| 50 HyperV Host.ps1 | Configures the Hyper-V host for nested virtualization |
- PowerShell 5.1 or higher
- AutomatedLab module installed
- For Azure deployment: Azure subscription and appropriate permissions
- For Hyper-V deployment: Windows 10/11 or Windows Server with Hyper-V role installed
# Clone the repository
git clone https://github.com/dsccommunity/DscWorkshop.git
cd DscWorkshop/Lab
# Deploy to Azure
.\00 Lab Deployment.ps1 -HostType Azure
# OR deploy to Hyper-V
.\00 Lab Deployment.ps1 -HostType HyperVThis will execute all scripts in the correct order, creating a complete lab environment.
If you need to run specific parts of the deployment:
# First import the lab if it exists but is not imported
Import-Lab -Name DscWorkshop -NoValidation
# Then run individual scripts as needed
.\20 Lab Customizations.ps1
.\31 New Release Pipeline DscConfig.Demo.ps1After deployment, you'll have the following key machines:
- DSCDC01: Domain Controller
- DSCCASQL01: SQL Server and Certificate Authority
- DSCPull01: DSC Pull Server
- DSCDO01: Azure DevOps Server
- DSCHost01: Hyper-V Host for nested virtualization
- DSCFile01-03, DSCWeb01-03: Target nodes for configuration
+------------+
| |
| DSCDC01 |
| |
+------------+
|
+-----------------------------------------------+
| | | |
+------------+ +------------+ +------------+ +------------+
| | | | | | | |
| DSCCASQL01 | | DSCPull01 | | DSCDO01 | | DSCHost01 |
| | | | | | | |
+------------+ +------------+ +------------+ +------------+
|
+-----------------------------+
| | |
+------------+ +------------+ +------------+
| DSCFile01 | | DSCWeb01 | | ... |
| DSCFile02 | | DSCWeb02 | | |
| DSCFile03 | | DSCWeb03 | | |
+------------+ +------------+ +------------+
After deployment, you can connect to any VM using:
# Get lab VM details
Get-LabVM
# Connect via RDP
Connect-LabVM -ComputerName DSCDO01During deployment, several VM snapshots are created to allow easy recovery:
- AfterInstall: Created after initial VM deployment
- AfterCustomizations: Created after software installation and customization
- AfterPipelines: Created after Azure DevOps pipeline setup
- AfterSqlReporting: Created after SQL reporting setup
To restore to a specific point:
# List available snapshots
Get-LabVMSnapshot -ComputerName DSCDO01
# Restore a specific VM to a snapshot
Restore-LabVMSnapshot -ComputerName DSCDO01 -SnapshotName AfterCustomizations
# Restore all VMs to a snapshot
Restore-LabVMSnapshot -All -SnapshotName AfterInstallThe lab includes scripts for automated DSC node onboarding:
- DscAutoOnboarding/Install-DscAutoOnboarding.ps1: Sets up the auto-onboarding environment
- DscAutoOnboarding/Start-DscAutoOnboarding.ps1: Script to run on target nodes for auto-onboarding
The lab includes SQL Server Reporting Services (SSRS) reports for DSC:
- Reports/NodeAdditionalInfo.rdl
- Reports/NodeConfigurationData.rdl
- Reports/NodeMetaData.rdl
- Reports/NodeStatusOverview.rdl
To access reports, you can use the shortcut created on the DSCDO01 desktop or navigate to: http://DSCCASQL01/Reports
If you want to manually configure a node to pull from the DSC Pull Server:
# On a target node, import required modules
Install-Module -Name xPSDesiredStateConfiguration
# Create a meta config
[DSCLocalConfigurationManager()]
configuration PullClientConfigID
{
Node localhost
{
Settings
{
RefreshMode = 'Pull'
ConfigurationMode = 'ApplyAndMonitor'
RefreshFrequencyMins = 30
RebootNodeIfNeeded = $true
}
ConfigurationRepositoryWeb PullServer
{
ServerURL = 'https://DSCPull01.contoso.com:8080/PSDSCPullServer.svc'
RegistrationKey = '42b8f0eb-07da-4a45-a3f7-d35cf4feb268'
AllowUnsecureConnection = $false
}
}
}
# Apply configuration
PullClientConfigID
Set-DscLocalConfigurationManager -Path ./PullClientConfigID -Verbose-
Network Connectivity Issues:
- Ensure all VMs are running and can communicate with each other
- Check the network configuration in Azure or Hyper-V
-
Certificate Errors:
- The lab uses a self-signed certificate authority
- Errors may occur if certificates are not properly distributed
-
Azure DevOps Access:
- Azure DevOps Server is accessible at:
https://DSCDO01:8080/AutomatedLab - Default credentials:
contoso\installwith passwordSomepass1
- Azure DevOps Server is accessible at:
-
DSC Pull Server Issues:
- Verify the pull server is running:
https://DSCPull01:8080/PSDSCPullServer.svc/
- Verify the pull server is running:
If you encounter significant issues, you can:
- Restore to a snapshot (see Lab Snapshots section)
- Remove the lab and redeploy:
Remove-Lab -Name DscWorkshop -Confirm:$false
.\00 Lab Deployment.ps1 -HostType HyperV