Authenticating to the NSX-T API via PowerShell
I've had the chance to work on some NSX-T scripting lately, as we work to integrate some other solutions with the tool. I don't have a ton of experience with API access, but I have been slowly learning... and one of the big hurdles that I had to overcome was just figuring out how to authenticate with the system! So, that's where I'm going to start here. First, let's talk about the basics of how authentication works when accessing the API. To use Basic authentication, you need to put together your credentials in the format of "username:password" and pass them to NSX-T. Since this is being passed through a web request and special characters could mess everything up, so you need to Base64 encode that authentication string. Once you've got it encoded, you need to put that into the Headers of your requests so that NSX-T will know who you are. So, let's look at how to actually do that process! First, I'm going to prepare two variables. One wil