How to integrate Windows DNS with vRA 7.x

This guide will show you how to setup vRealize Automation 7.x to automatically create a static host A record and a reverse look up pointer in your Windows based DNS. This is most often needed to be able to automate deployments of Linux machines as Linux does not play well with Windows Based DNS when you are using static IP address assignment. However, you can also use this with Windows machines if you don’t allow self registration of Windows on your network.

Pre-Reqs

  • vRA 7 installed and configured with at least one blueprint that has static IP address network profile assigned
  • vRA Plugin for vRO configured see my guide here
  • vCenter Plugin for vRO configured
  • At least one Windows Server with DNS Server tools installed (DNSCMD.exe) Pro TIP: This could be one of your vRA IaaS or DEM servers as long as they are visible from the vCenter Plugin.
  • vRO workflow package downloaded from here
  • a quiet place where you will not be interrupted see my guide here

First, make sure you can use the dnscmd from the Windows server and have the account rights to create A records.

If you get an error that dnscmd was not found you need to add this role to the server.

Now open the vRealize Orchestrator (vRO) client

  1. Click drop down to Administer
  2. Click the Package Tab
  3. Click Import Package

Locate the package you downloaded and click open

Now click import

Accept any warnings and import the package

Verify the workflow was properly installed

  1. Click the drop down to change to run
  2. Click the Workflows tab
  3. Drill down to the workflow

Update the workflow with the Windows Server and the username and login

  1. Select the workflow
  2. Click edit

Update the attributes

  1. Select the Windows server that has DNSCMD installed
  2. Enter a user with rights to login to that server and rights to administer the DNS server
  3. Enter the password for that user
  4. Click Save and Close

Now open vRA portal

  1. Click Design
  2. Select a blueprint with a static IP Network Profile
  3. Click edit

Enter the following custom properties

  1. Click Properties
  2. Click Custom Properties
  3. Enter the new properties as shown
  4. Click Finish
Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.MachineProvisioned   *

dnsserver   mydns.corp.local

Create and publish a new event subscription

  1. Click Administration Tab
  2. Click Events, Subscriptions
  3. Click +New

Select machine provisioning and click next

On the next screen click Run Based on conditions the choose All of the following

screen-shot-2016-09-26-at-2-55-45-pm

On the Clause Drop down browse down to the following state and select it.

Select Equals and then choose the following constant

Now click add expression

Select the following

Now select Equals and the following constant and then click Next

Now click +add expression

Now select Equals

Now enter the following and then press next

Select the workflow we added then press next

Select blocking and then click finish

Select the new subscription then click Publish

Fire off a new request

Monitor the workflow logs in vRO client

Enjoy being able to reach newly provisioned machines by name

Want to remove the record on Deporivisoning? See Part II – Delete DNS Record
Remember sharing is caring!

23 Replies to “How to integrate Windows DNS with vRA 7.x”

  1. Pingback: How to integrate Windows DNS with vRA 7.x Part II – Delete DNS Record – VMtoCloud.com

  2. Pingback: Automated DNS registration with vRA | viktorious.nl – Virtualization & Cloud Management

  3. Thank You So much for this. I am able to get DNS entry added using the workflow package you provided. I would like to through a question back to you, my customer has a requirement to add Linux server to be part of 2 different domain, but same DNS server. Can you please help me ?

  4. I’m getting an “IO Exception. Not a valid package file, dunes-meta-inf is missing!” error while trying to import the package. Is there a newer version of this package for vRO 7.3?

  5. When I select the Window VM attribute, I could not see any VM listed. I saw this error . Why is that ?
    I already added the vCenter server instance . How come I cannot see any VMs displayed ?

    https://10.139.53.68:443/sdk (unusable: java.lang.ClassCastException: com.vmware.vcac.authentication.http.spring.oauth2.OAuthToken cannot be cast to com.vmware.vim.sso.client.SamlToken)

    Timothy

  6. Hi Ryan ,
    I’ve implemented you solution, but the EB-MachineProvisioned-DNSADD workflow terminate with the following Error:
    2017-11-29 12:49:37.446] [E] Error in (Workflow:Create temporary directory in guest / Scriptable task (item1)#8) Permission to perform this operation was denied.
    [2017-11-29 12:49:37.464] [E] Workflow execution stack:
    ***
    item: ‘Run Script In Guest/item33’, state: ‘failed’, business state: ‘null’, exception: ‘Exception binding empty’
    Can you please give me an Idea or a suggestion?
    Thank you very much for your help
    Alex

  7. How can I add to a custom suffix? For example if my domain is “lab.local” and want the script to add the VMs in “cloud.lab.local”.

    The subdomain already exists.

    Thanks in advance.

  8. I’m still trying to pass a different “dnsdomain” string. By default without any modifications it runs on the default domain where the DNS is running. But I have a group of blueprints that should be in another DNS domain. I’ve added the Custom Property “dnsdomain” but it just ignores it.

    Any ideas?

    Thanks

    • I’ve found it!

      var dnsdomain = vCACVmProperties.get(“VirtualMachine.Network0.DnsSuffix”) ;
      🙂

      • I now have another issue. It’s working fine unless the blueprint consists of more than 1 VM. If i launch a blueprint with, for example, 5 VMs, sometimes 2 o 3 don’t get registered. If I manually re-launch the job from the orchestrator it works fine.

        There is a timing issue, somewhere. The workflow fails in “isToolsOk?”, but tools seems to be ok:

        [2018-07-07 10:26:54.144] [I] Getting the custom properties needed
        [2018-07-07 10:26:54.171] [I] toolsOK
        [2018-07-07 10:26:54.173] [I] VMware tools on VM WADSRV05 are in state: toolsOk and guest is running
        [2018-07-07 10:26:54.319] [E] Error in (Workflow:Create temporary directory in guest / Scriptable task (item1)#8) The operation is not allowed in the current state.

        • I’ve got this same problem. Seems like the requests from the workflow are getting jammed up on the vm to execute the script. I have several blueprints that build up to 10 vms at a time. Only maybe 3 or 4 dns adds are successful if all 10 are submitted. I would like to see some ‘wait’ function added here so the workflow will pause until “Command completed successfully.” is returned from the server executing the script. The same would need to be done for the DNSREMOVE workflow.

  9. Has anyone figured out how submit a request for blueprint with more than one server and not have the server that’s executing the dnscmd commands return with error:

    “Error in (Workflow:Create temporary directory in guest / Scriptable task (item1)#8) The operation is not allowed in the current state.”

    Is there some way to stack the vRA requests to vRO and execute one through completion before trying to send another one? It’s as if the target vm dnscmd is being run isn’t ready regardless if the vmtools says it is.

  10. Thanks a lot for the article. it helped a lot. Could you please help for the deletion at the the time of Vm decomission.
    And how can we add it day 2 operation.

  11. Hi,
    I need to add an exception in this. It should check if A recor already exist on that IP, if yes it should trigger on mail else should create the record.

Leave a Reply to jahid khan Cancel reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.