How to Create and Replace the NSX Manager Web, API, and APH-AR Certificates using PowerShell
I recently resetup NSX in my home lab. I setup NSX 184.108.40.206. After completing the appliance stand up, we need to create/install a certificate for the NSX Manager Web Interface. This is based on my VMware Explore 2020 presentation:
Install Notepad++ or another code editor to view PS1 and Log files. You will also need an API utility. I will be using PostMan.
Go to my GitHub and download the PowerShell Scripts to generate the NSX web certificate with: https://github.com/butch7903/VMwareCertificates
Create a folder at the root of C called certs, place the zip bundle there and and explode it. You will need the Root and Intermediate PS1 along with all the NSX-T PS1 files.
Edit the Generate Root and Intermediate PS1 file. You will need to update the names of the Rootmatch and Intermediatematch variables. Close the Script and then run it. This will generate the root and intermediate certificates in the correct format for NSX
Edit the NSX-T Manager VIP Certificate PS1 File. You will need to update all of the variables with the correct information, save it, and then run the PS1 script. It is recommended that you have the DNS entry created for the VIP prior to installation.
Copy the Generate VMware NSX-T Node Certificate Files 1.2 PS1 file 3x. Name each file the name of each NSX Manager, then edit each files variables information, save it, and then run the PS1 script for each NSX Manager.
Login to NSX Manager > System > Certificates > Click on Import Certificate
Input the Name of the NSX Manager VIP (start with this cert first), Turn off Service Certificate, Click on Browse for Certificate, Select the nsx-mgr-sslCertificateChain.pem file, Click on Browse for Private Key, Select the nsx-mgr.key, and Click Save
Repeat Steps 6-7 for all NSX Manager Node Certificates.
Click on Trusted CA Bundles > Import CA Bundle
Type in the name of your CAs for Name, Browse for the Certificate. This will be the combined CA PEM File (CombinedCA_HAMCA01-CA-PEM.pem), and Click Save
Use PostMan to Change your Certificates
This is based on the the replace certifications documentation from VMware found below.
Open PostMan, Click on Collections > New NSX-T
Click on New
Click on Authorization, Select Type Basic Authentication, Type in the Username and Password
Login to NSX Manager > System > Certificates. Document the IDs of all the certificates you imported earlier.
Copy the below API Call and modify it for your use. This API call is to be used with the NSX VIP Certificate/IP. You will need to replace the <nsx-mgr> and <VIP-Cert-ID> areas with the right info
Click on Send. If Status 200 OK is returned, it was successful!
Test the new certificate by browsing to it. If it shows up secure, you did your job correctly! (You may want to test with incognito mode to validate this properly)
Clone the Post NSX VIP Entry, call it NSX Get Nodes
API Call will be like below. Please update it with your NSX manager name.
Document the Node IDs and IPs for each Node and corrorlate that with the Node's Certificate ID
Note you can also get the Node IDs from the Certificates area under where used.
Repeat steps 2-5 using below API call to replace the certificates for the NSX Manager Nodes.
Validate in NSX that the certificates have been replaced.
Repeat Steps 2-5 for all nodes to replace the APH Certificate for the NSX Manager Nodes.
After Validation of a Certificates in the NSX Manager Certificate interface (note you may have to refresh this screen manually), you can clean up the unused self-signed certificates. Delete the certificates that are no longer used.