I am currently working on some PowerShell scripts to verify the user and group permissions on VMware products. For vCenter Server, the PowerCLI provides cmdlets to do the job. However for vRealize Operations Manager (vROPS) and Log Insight this is not the case (Yes, vROPS has some cmdlets but not for getting permissions). Luckily, both products do include a REST API, so time to investigate.
PowerShell offers two commands to interact with REST API’s; Invoke-WebRequest and Invoke-RestMethod. After reading this post from Adam Bertram I decided to give Invoke-RestMethod a try, the next step was how to start?
Reading “Introduction to PowerShell Rest API Authentication” from Joshua Stenhouse, was very helpful. So after some practicing with his vROPS example, which can be found here, it was time to figure out how to setup authentication for Log Insight.
A good starting point is the API documentation. Besides documentation, the Log Insight GUI also provides access; In the upper-right corner, open the drop-down menu and select Help. On this page, you will find a link to the REST API Documentation.
The REST-API can also directly be accessed by this URL:
https://fqdnLogInsight/rest-api.