Adding an LDAP domain to NSX Manager via REST call

If you’re using NSX Manager 6.1.x (mine is 6.1.4) and you try to add an LDAP domain you might encounter the following error:

A quick Google search and you realise this is a known bug affecting 6.1.x

https://www.vmware.com/support/nsx/doc/releasenotes_nsx_vsphere_620.html

Really VMware? #facepalm Pretty annoying to be honest, this seems a pretty basic functionality that should have been tested by the QA team – cough – QA what ? cough.

Anyway, as I’m preparing for my VCIX-NV I haven’t got much time to “waste” and decided to do it via REST call.

So using the official API documentation I found there is this updateDomain API call

Well, I’m going to keep this post short and straightfoward: the following xml code provided in the documentation is wrong!

<?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <DirectoryDomain>
 <name>corp.local</name>
 <type>ActiveDirectory</type>
 <netbiosName>CORP</netbiosName>
 <username>Administrator</username>
 <password>VMWare1!</password>
 </DirectoryDomain>

if you try to execute a POST (using your favouring REST client, Postman for me) you’ll get a nice 404 error

After some playing and guessing the code that worked for me was the following

<DirectoryDomain>
<name>corp.local</name>
<type>ACTIVE_DIRECTORY</type>
<netbiosName>CORP</netbiosName>
<username>Administrator</username>
<password>VMWare1!</password>
</DirectoryDomain>

Also the POST address with didn’t work for me and I had to use https://<NSX-Manager>/api/1.0/directory/updateDomain

And here we go the domain is then visible from the GUI, after which I could update it without problems.

Nice job VMware!
nice job

 

 

 

 

Leave a Comment

Your email address will not be published.

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