PRO: Domains

PRO: Domains #

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 Domains #

SQLDSC supports configuring machines in diffrent domains. This is done by filtering machines based on domain and assiging different defaults based on the domain. These are handled very differently. Pleaes read carefully.

Domain Targets #

The PRO version can use domain specific target files. If you do nothing different, it will continue to use targets.hcl.

You can create domain specific target files. For example,

  • DOMAIN1.targets.hcl for domain1 (it’s not case-sensitive)
  • DOMAIN2.targets.hcl for domain2

By default, the PRO version will run for the domain specified in the USERDOMAIN environment variable. This variable is automaticallly set by Windows for all domain joined computers. SQLDSC will search for a target file for that domain. If it doesn’t find one it will fall back to targets.hcl. If you’re using domain specific target files, you should probably delete targets.hcl or leave it empty.

To run for a differnt domain than the current one, specify a domain using the the --domain parameter. This parameter only applies to the test and apply commands. For example,

sqldsc test --domain other-domain --verbose 

This will process the targets listed in OTHER-DOMAIN.targets.hcl (or targets.hcl if that file isn’t found). Processing for a separate domain is often used to handle multiple domains where a trust relationship and connectivity are available.

In summary, the domain of the machine where SQLDSC is run detrmines which target file is used by default.

Domain Defaults #

The PRO version also support domain specific defaults. After processing defaults.hcl, it will look for domain specific defaults.

The order of default files processed is

  1. defaults.hcl
  2. DOMAIN_ONE.defaults.hcl
  3. All tag files in order (see Tags)
  4. nodes\node.hcl
  5. nodes\node__instance.hcl
  6. nodes\DOMAIN_ONE\node.hcl
  7. nodes\DOMAIN_ONE\node__instance.hcl

Remember that later processed files override values in earlier files.

Note: The domain of the target itself is used to determine the domain default file and locate the nodes file. This may be different than the domain specified on the command line or the target file used.

Notes #

  1. The domain targets aren’t strict. You could put reachable targets in DOMAIN_ONE.defaults.hcl that aren’t actually in the domain. When getting the configuration files, it looks at the server’s domain (using USER_DOMAIN()) to determine which domain default file to use. Be very careful crossing domain lines.