PRO: Variables

PRO: Variables #

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

While in beta, you can enable the Professional Edition by creating an empty key.xt file next to the sqldsc.exe file.

The PRO edition will become a paid version. Until then, PRO features expire 90 days after the build date. Please see for updated builds or run sqldsc update.

Starting in 1.37, the PRO Edition allows variables to set attribute values.

# roles/read-only.hcl
login "placeholder" {
    login = "${read-only-account}"
    permissions = ["view server state"]
    user_databases {
        roles = ["db_datareader"]

# roles/txn-ag.hcl
# configure the nodes the txn-ag Availability Group
variable "read-only-account" {
    value = "PROD\txn-ag-read-only"

# targets.hcl 
target "ag-node-01" {
    add_roles = ["txn-ag", "read-only"]
target "ag-node-02" {
    add_roles = ["txn-ag", "read-only"]

The read-only role uses a login block to configure permissions for a login. The particular login is in the read-only-account variable. That variable is defined in the txn-ag role. That role is assigned to two nodes (which happen to be members of AG in this scenario)

Variables can only set attribute values and not block labels or block names. This is a quirk of the parser that may get change one of these days. Thus the placeholder in the above example.