PRO: Availability Groups

PRO: Availability Groups #

All features described on this page are part of the Professional Edition.

You can purchase licenses for the Professional Edition on the Portal: https://portal.sqldsc.com.

Handling Availability Groups #

SQLDSC supports Availability Groups in a number of way. For normal (non-contained) Availability Groups

  • Only put the individual nodes in as targets – not the Listener
  • Put all those nodes in a tag named for the Availability Group
  • Use that tag for the AG settings. These will be applied to all the nodes. THis way they will all get the same logins, jobs, linked servers, etc.

Contained Availability Groups #

Contained Availability Groups (CAG) allow logins, jobs, etc. to be created at the Availability Group level. Staring in version 1.46, SQLDSC adds support for CAGs. If you want to add items at the CAG level, put the individual nodes AND the Listener in as targets and assign the nodes a tag for the Availability Group.

Things that should be on all nodes of the CAG, but not in the CAG, go in the tag. Things that will be created in the CAG, go in a node file named for the CAG (not the AG). That looks roughly like this:

config\
    nodes\
        agname.hcl
    tags\
        ag-tag.hcl
    defaults.hcl
    targets.hcl

The targets file looks like this:

target "node1" {tags = ["ag-tag"]}
target "node2" {tags = ["ag-tag"]}
target "listener" {}

ag_apply_mode #

Each resource can have an ag_apply_mode setting. The possible values are ag and node.

  • When connected to the CAG Listener, resources where ag_apply_mode="node" will NOT be deployed
  • When connected to a node of a CAG, resources where ag_apply_mode="ag" will NOT be deployed