Last week, I had spent some time exploring and getting myself more familiar with NSX-T, which is the next generation release of the NSX platform from VMware. One of the first thing I do when learning about a new product is to setup a lab environment that I can using. Having gone through the deployment once by hand, I realized it would be quite painful if I needed to do this again, which I know I will and I did 🙂 I wanted to have a simliar experience to my vGhetto Automated vSphere Lab deployment script which also including setting up the entire vSphere infrastructure along with deploying and configuring NSX-V and extending it to support NSX-T.

Since my original script leverages PowerCLI to access both the vSphere and NSX APIs, I wanted to do the same with NSX-T. Funny enough, the PowerCLI team had just published an update release (6.5.3) which also added support for NSX-T and I thought this was perfect timing to try out the NSX-T APIs, which I had never used before.

UPDATE (01/01/2018) - I have verified the script also works with the latest NSX-T 2.1 which was just released before Christmas. The script has also been updated to create a new Edge Uplink Profile along with an Edge Cluster and automatically associate all Edge VMs to Edge Cluster.

I have created a new Github repository called vghetto-nsxt-automated-lab-deployment which contains detailed instructions along with the PowerCLI script.

Here is what the script is currently performing:

  1. Deploy and configure vCenter Server Appliance 6.5u1
  2. Deploy and configure 3 x Nested ESXi 6.5u1 Virtual Appliance VMs and attaching it to vCenter Server
  3. Deploy NSX-T Manager, 3 x Controllers & 1 x Edge and setup both the Management and Control Cluster Plane
  4. Configure NSX-T with IP Pool, Transport Zone, Add vCenter Server as Compute Manager, Create Logical Switch, Prepare ESXi hosts, Create Uplink Profile & Add configure ESXi hosts as a Transport Node

Similiar to the vSphere version of this script, all deployed VMs will be placed inside of a vCenter vApp construct as shown in the example screenshot below:

Here is an example output of a succesful deployment and you go from nothing to a fully functional NSX-T environment in just 50 minutes, which is pretty awesome if you ask me!?

Here are a few additional screenshot of NSX-T UI after deployment and you should the NSX Manager and Controller Nodes registered.

If you go into Fabric->Nodes->Hosts, you should see all the ESXi hosts that was deployed, prepared and associated with NSX-T

Obviously, I have only scratched the surface of NSX-T and its automation capabilities and while the deployment is fairly basic, it does enable customers to quickly spin up an NSX-T environment without any prior knowledge. Hopefully I will be able to expand on this script in the future and if folks would like to contribute back, feel free to submit a pull request to the Github repository. It was definitely a learning experience using the new NSX-T APIs and for areas where there were Automation gaps, I was able to take advantage of a recently published article I had on sending keyboard keystrokes to a VM using the vSphere API which was quite handy for places where I did not want to rely on SSH. I definitely have some feedback to share with the NSX team and hopefully we can improve NSX-T in future releases so both initial setup and day operations can be even easier!

9 thoughts on “vGhetto Automated NSX-T 2.0 Lab Deployment

  1. I’m still struggling with the automatic customizing of the nested esxi hosts: one half of the esxi have hostnames and ips configured, the other half of the nested esxi is coming up with “localhost” and an ip address assigned by DHCP. Any ideas?

  2. Hi, is the $VirtualSwitchType = “VSS” # VSS or VDS working well?

    Its giving me problems.

    [10-31-2017_09:39:59] Adding vmnic2/vmnic3 to VSS00-VLAN310-VTEP …
    New-NetworkAdapter : 31/10/2017 9:39:59 PM New-NetworkAdapter Could not find VirtualPortGroupBase with name

  3. I seem to be struggling with configuring the NSX installation, despite being able to login to the NSX manager through the web UI nad everything appears normal I get the following error

    Connection to NSX server x.x.x.x failed : Invoke-NsxRestMethod : The NSX
    API response received indicates a failure. 404 : : Response Body:
    At C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PowerNSX\PowerNSX
    .psm1:4634 char:13
    + Throw “Connection to NSX server $NsxServer failed : $_”
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Connection to N…Response Bo
    dy: :String) [], RuntimeException
    + FullyQualifiedErrorId : Connection to NSX server x.x.x.x failed : I
    nvoke-NsxRestMethod : The NSX API response received indicates a failure. 4
    04 : : Response Body:

    Tried connecting using the following commands to the NSX Manager with the same error.
    Connect-NsxServer -Server x.x.x.x -Username admin -Password VMware1! -WarningAction SilentlyContinue
    Connect-NsxServer -NsxServer x.x.x.x -Username admin -Password VMware1! -WarningAction SilentlyContinue

    Manual configuration seems to work just fine.


    • The command list for PowerCLI vs the version of PowerNSX I was trying to use were different, updating to the latest version of PowerCLI resolved this issue.

  4. I have problem executing the script. In the on-screen log everything was green, but i found that now ESXis are added to the fabric and no edge was added to edge nodes. I tried to make manual cluster config and prepare the nodes. I also installed manually an edge. Tried to run the script again .. but it fails on:

    (Get-NsxtService -Name “com.vmware.nsx.fabric.nodes”).list().results

    Unable to get field ‘resource_type’, no field of that name found
    At line:1 char:1
    + (Get-NsxtService -Name “com.vmware.nsx.fabric.nodes”).list().results
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], CisException
    + FullyQualifiedErrorId : VMware.VimAutomation.Cis.Core.Types.V1.CisException

    Not sure if there is some API change, but this service always fail with the same error.

Thanks for the comment!

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