Table of Contents

  1. Getting Started
  2. Command Line
  3. File Layout
  4. Targets
  5. Resource Blocks
  6. Credential Vault
  7. Releases

Getting Started

  1. I suggest using Visual Studio Code to edit the files.
  2. Open up the directory where sqldsc.exe is located. Pressing control-` (back tick) will bring up a command prompt in VSCode.
  3. sqldsc init will create the config directory and a sample defaults.hcl, targets.hcl, and a file for the current computer. Please review these and edit if needed.
  4. sqldsc test will compare the configuration (in defaults.hcl and a file named after the current computer) to the target servers (in targets.hcl) and list any required changes.
  5. sqldsc apply will apply the changes. It tests the configuration and then prompts for a confirmation.
  6. sqldsc help will list the parameters
  7. This has been extensively tested from SQL Server 2014 on. SQL Server 2012 has recieved limited testing. SQL Server 2008 should work but has had very little testing.

Command Line

sqldsc command [-path _path_]

Parameters

File Layout

By default, the configuration files are stored in the config directory.

config\
    nodes\
        ServerA.hcl
        ServerA__instance1.hcl
    defaults.hcl
    targets.hcl

Targets

A sample targets.hcl looks like this:

target "D40\SQL2014" {}
target "server.domain.com" {}

The text in quotes is what it will try to connect to. The full layout of a targets file might look like this:

target_defaults {
    dial_timeout = 10
    connect_timeout = 15
}

target "my-target" {
    fqdn = "host:port"
    dial_timeout = 90
}

Resource Blocks

Resource blocks have the following format. The resource_name isn’t currently used except to identify the blocks in error messages.

resource "resource_type" "resource_name" {
    ensure = "present"
    ... other key value entries ...
}

This is an example Resource Block that creates a SQL Server agent operator:

resource "agent_operator" "june" {
    ensure = "present"
    name = "june"
    email_address = "june@test.com"
}

A fake sample showing all the data types:

resource "fake_resource" "fake" {
    ensure = "present"
    string_val = "value"
    int_val = 37
    bool_val = true
}

Resource Block Schema

Please see the SQLDSC_Schema.html document.

Credential Vault

SQLSDC provides a simple vault to store credentials securely using the Windows DPAPI. These are stored in a JSON file in %LOCALAPPDATA%\sqldsc\.vault.json. This directory is specific to each user. You can see the credential name and login name in clear text but the password is encrypted. The login name isn’t used in the current release.

The DPAPI encrypts with a user key and a machine key. That means the file can’t be shared across users or machines.

The following commands are available

The most common use case is creating identical logins across multiple servers with the same password. Examples include monitoring tools that require SQL Server logins or Availability Groups that need identical logins.

In the login resource, you can specify the sqldsc_credential and it will use the password from that credential for the login.

Releases

1.30.1 (19 May 2020)


1.27 (5 May 2020)


1.26 (4 May 2020)


1.25 (28 April 2020)

1.24.1 (26 April 2020)

1.23 (24 April 2020)

1.22 (22 April 2020)

1.21 (19 April 2020)

1.20.1 (17 April 2020)

1.18 (12 April 2020)

1.17 (9 April 2020)

1.16 (4 April 2020)

1.0.15 (24 March 2020)

1.0.14 (15 March 2020)

1.0.12 (14 March 2020)

1.0.11 (8 March 2020)

1.0.10 (3 March 2020)

Deprecated

The following objects are deprecated


© 2020 ScaleOut Consulting, LLC