github.com/philhug/dnscontrol@v0.2.4-0.20180625181521-921fa9849001/docs/_providers/activedir.md (about)

     1  ---
     2  name: ActiveDirectory_PS
     3  layout: default
     4  jsId: ACTIVEDIRECTORY_PS
     5  title: ActiveDirectory_PS Provider
     6  ---
     7  # ActiveDirectory_PS Provider
     8  This provider updates an Microsoft ActiveDirectory server DNS server. It interacts with AD via PowerShell commands that are generated and executed on the local machine. This means that DNSControl must be run on a Windows host. This driver automatically deactivates itself when run on non-Windows systems.
     9  
    10  # Running on Non-Windows systems
    11  For debugging and testing on non-Windows systems, a "fake PowerShell" mode can be used, which will activate the driver and simulate PowerShell as follows:
    12  
    13  - **Zone Input**: Normally when DNSControl needs to know the contents of an existing DNS zone, it generates a PowerShell command to gather such information and saves a copy in a file called `adzonedump.ZONE.json` (where "ZONE" is replaced with the zone name).  When "fake PowerShell" mode is enabled, the PowerShell command is not run, but the `adzonedump.ZONE.json` file is read. You must generate this file ahead of time (often on a different machine, one that runs PowerShell).
    14  - **Zone Changes**: Normally when DNSControl needs to change DNS records, it executes PowerShell commands as required.  When "fake PowerShell" mode is enabled, these commands are simply logged to a file `dns_update_commands.ps1` and the system assumes they executed.
    15  
    16  To activate this mode, set `"fakeps":"true"` inside your credentials file for the provider.
    17  
    18  ## Configuration
    19  
    20  The `ActiveDirectory_PS` provider reads an `ADServer` setting from`creds.json` to know the name of the ActiceDirectory DNS Server to update.  
    21  
    22  {% highlight javascript %}
    23  {
    24    "activedir": {
    25      "ADServer": "ny-dc01"
    26    }
    27  }
    28  {% endhighlight %}
    29  
    30  
    31  If you want to modify the "fake powershell" mode details, you can set them in the credentials file:
    32  
    33  {% highlight javascript %}
    34  {
    35    "activedir": {
    36      "ADServer": "ny-dc01",
    37      "fakeps": "true",
    38      "pslog": "powershell.log",
    39      "psout": "commandsToRun.ps1"
    40    }
    41  }
    42  {% endhighlight %}
    43  
    44  
    45  An example DNS configuration:
    46  
    47  {% highlight javascript %}
    48  var REG_NONE = NewRegistrar('none', 'NONE')
    49  var ACTIVEDIRECTORY = NewDnsProvider("activedir", "ACTIVEDIRECTORY_PS");
    50  
    51  D('example.tld', REG_NONE, DnsProvider(ACTIVEDIRECTORY),
    52        A("test","1.2.3.4")
    53  )
    54  {% endhighlight %}
    55  
    56  To generate a `adzonedump.ZONE.json` file, run `dnscontrol preview` on a Windows system then copy the appropriate file to the system you'll use in "fake powershell" mode.
    57  
    58  The `adzonedump.ZONE.json` files should be UTF-16LE encoded. If you hand-craft such a file on a non-Windows system, you may need to convert it from UTF-8 to UTF-16LE using:
    59  
    60      iconv -f UTF8  -t UTF-16LE <adzonedump.FOO.json.utf0 > adzonedump.FOO.json
    61  
    62  If you check these files into Git, you should mark them as "binary" in `.gitattributes`.