Configurations

At the heart of DSC are configurations—your infrastructure as code. Configurations are repeatable and can be versioned, verified, and idempotent. Moreover, they are transportable between different environments—provided those environments should look alike.

When compiled and deployed, configurations will do the same as your existing scripts. While those are imperative (install feature, deploy web app), DSC is declarative.

Take the following example, which illustrates the difference:

# ImperativeInstall-WindowsFeature -Name AD-Domain-Services, RSAT-AD-Tools -IncludeAllSubFeature# What happens if the feature cannot be enabled in your build script?$param = @{    DomainName = 'contoso.com' SafeModeAdministratorPassword = Read-Host ...

Get Learn PowerShell Core 6.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.