Module with DSC Resources for deployment and configuration of Microsoft SQL Server.

Minimum PowerShell version


There is a newer prerelease version of this module available.
See the version list below for details.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name SqlServerDsc -RequiredVersion

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deloy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More


Microsoft Corporation


(c) 2018 Microsoft Corporation. All rights reserved.



DesiredStateConfiguration DSC DSCResourceKit DSCResource


SqlAG SqlAGDatabase SqlAgentOperator SqlAGListener SqlAGReplica SqlAlias SqlAlwaysOnService SqlDatabase SqlDatabaseDefaultLocation SqlDatabaseOwner SqlDatabasePermission SqlDatabaseRecoveryModel SqlDatabaseRole SqlRS SqlRSSetup SqlScript SqlScriptQuery SqlServerConfiguration SqlServerDatabaseMail SqlServerEndpoint SqlServerEndpointPermission SqlServerEndpointState SqlServerLogin SqlServerMaxDop SqlServerMemory SqlServerNetwork SqlServerPermission SqlServerReplication SqlServerRole SqlServerSecureConnection SqlServiceAccount SqlSetup SqlWaitForAG SqlWindowsFirewall


This module has no dependencies.

Release Notes

- Changes to SqlServerDsc
 - Added new resources.
   - SqlRSSetup
 - Added helper module DscResource.Common from the repository
   - Moved all helper functions from SqlServerDscHelper.psm1 to DscResource.Common.
   - Renamed Test-SqlDscParameterState to Test-DscParameterState.
   - New-TerminatingError error text for a missing localized message now matches
     the output even if the "missing localized message" localized message is
     also missing.
 - Added helper module DscResource.LocalizationHelper from the repository
   DscResource.Template, this replaces the helper module CommonResourceHelper.psm1.
 - Cleaned up unit tests, mostly around loading cmdlet stubs and loading
   classes stubs, but also some tests that were using some odd variants.
 - Fix all integration tests according to issue [PowerShell/DscResource.Template14](https://github.com/PowerShell/DscResource.Template/issues/14).
- Changes to SqlServerMemory
 - Updated Cim Class to Win32_ComputerSystem (instead of Win32_PhysicalMemory)
   because the correct memory size was not being detected correctly on Azure VMs
   ([issue 914](https://github.com/PowerShell/SqlServerDsc/issues/914)).
- Changes to SqlSetup
 - Split integration tests into two jobs, one for running integration tests
   for SQL Server 2016 and another for running integration test for
   SQL Server 2017 ([issue 858](https://github.com/PowerShell/SqlServerDsc/issues/858)).
 - Localized messages for Master Data Services no longer start and end with
   single quote.
 - When installing features a verbose message is written if a feature is found
   to already be installed. It no longer quietly removes the feature from the
   `/FEATURES` argument.
 - Cleaned up a bit in the tests, removed excessive piping.
 - Fixed minor typo in examples.
 - A new optional parameter `FeatureFlag` parameter was added to control
   breaking changes. Functionality added under a feature flag can be
   toggled on or off, and could be changed later to be the default.
   This way we can also make more of the new functionalities the default
   in the same breaking change release ([issue 1105](https://github.com/PowerShell/SqlServerDsc/issues/1105)).
 - Added a new way of detecting if the shared feature CONN (Client Tools
   Connectivity, and SQL Client Connectivity SDK), BC (Client Tools
   Backwards Compatibility), and SDK (Client Tools SDK) is installed or
   not. The new functionality is used when the parameter `FeatureFlag`
   is set to `"DetectionSharedFeatures"` ([issue 1105](https://github.com/PowerShell/SqlServerDsc/issues/1105)).
 - Added a new helper function `Get-InstalledSharedFeatures` to move out
   some of the code from the `Get-TargetResource` to make unit testing
   easier and faster.
 - Changed the logic of "Build the argument string to be passed to setup" to
   not quote the value if root directory is specified
   ([issue 1254](https://github.com/PowerShell/SqlServerDsc/issues/1254)).
 - Moved some resource specific helper functions to the new helper module
   DscResource.Common so they can be shared with the new resource SqlRSSetup.
 - Improved verbose messages in Test-TargetResource function to more
   clearly tell if features are already installed or not.
 - Refactored unit tests for the functions Test-TargetResource and
   Set-TargetResource to improve testing speed.
 - Modified the Test-TargetResource and Set-TargetResource to not be
   case-sensitive when comparing feature names. *This was handled
   correctly in real-world scenarios, but failed when running the unit
   tests (and testing casing).*
- Changes to SqlAGDatabase
 - Fix MatchDatabaseOwner to check for CONTROL SERVER, IMPERSONATE LOGIN, or
   CONTROL LOGIN permission in addition to IMPERSONATE ANY LOGIN.
 - Update and fix MatchDatabaseOwner help text.
- Changes to SqlAG
 - Updated documentation on the behaviour of defaults as they only apply when
   creating a group.
- Changes to SqlAGReplica
 - AvailabilityMode, BackupPriority, and FailoverMode defaults only apply when
   creating a replica not when making changes to an existing replica. Explicit
   parameters will still change existing replicas ([issue 1244](https://github.com/PowerShell/SqlServerDsc/issues/1244)).
 - ReadOnlyRoutingList now gets updated without throwing an error on the first
   run ([issue 518](https://github.com/PowerShell/SqlServerDsc/issues/518)).
 - Test-Resource fixed to report whether ReadOnlyRoutingList desired state
   has been reached correctly ([issue 1305](https://github.com/PowerShell/SqlServerDsc/issues/1305)).
- Changes to SqlDatabaseDefaultLocation
 - No longer does the Test-TargetResource fail on the second test run
   when the backup file path was changed, and the path was ending with
   a backslash ([issue 1307](https://github.com/PowerShell/SqlServerDsc/issues/1307)).

Version History

Version Downloads Last updated
14.0.0-previ... 20 5/28/2020
14.0.0-previ... 19 5/25/2020
14.0.0-previ... 1 5/25/2020
14.0.0-previ... 13 5/19/2020
14.0.0-previ... 9 5/19/2020
14.0.0-previ... 16 5/17/2020
14.0.0-previ... 2 5/17/2020
14.0.0-previ... 1 5/16/2020
14.0.0-previ... 2 5/14/2020
14.0.0-previ... 4 5/13/2020
14.0.0-previ... 9 5/12/2020
14.0.0-previ... 1 5/12/2020
14.0.0-previ... 1 5/12/2020
14.0.0-previ... 14 5/8/2020
14.0.0-previ... 1 5/6/2020
14.0.0-previ... 3 5/5/2020
14.0.0-previ... 3 5/4/2020
14.0.0-previ... 2 5/3/2020
14.0.0-previ... 1 5/3/2020
14.0.0-previ... 16 4/27/2020
14.0.0-previ... 7 4/26/2020
13.5.0 17,016 4/12/2020
13.5.0-previ... 7 4/11/2020
13.5.0-previ... 9 4/11/2020
13.4.1-previ... 35 3/31/2020
13.4.0 121,159 3/18/2020
13.4.0-previ... 3 3/18/2020
13.3.1-previ... 49 1/18/2020
13.3.0 459,141 1/17/2020
13.3.0-previ... 3 1/17/2020
13.3.0-previ... 10 1/12/2020
13.3.0-previ... 4 1/8/2020
13.3.0-previ... 7 1/7/2020
13.3.0-previ... 3 1/3/2020
13.3.0-previ... 3 1/2/2020
13.3.0-previ... 5 1/2/2020 776,074 9/19/2019 34,329 8/8/2019 25,653 6/26/2019 16,020 5/15/2019 (current version) 21,030 4/3/2019 39,683 2/20/2019 8,435 1/10/2019 21,454 10/25/2018 16,916 9/5/2018 15,963 7/25/2018 7,139 6/13/2018 3,838 5/2/2018 4,084 3/22/2018 8,135 2/8/2018 3,514 12/14/2017
Show less