From the 7.2 documentation, I am supposed to be able to request an HTTP Bearer token using cred with the following command:
curl --insecure -H "Accept: application/json" -H 'Content-Type: application/json' --data '{"username":"TenantAdminUser@example.com","password":"password","tenant":"MYCOMPANY"}' https://vra.mycompany.com/identities/api/tokens
As I couldn't get this to work in a reasonable way (Cannot bind parameter 'Headers'. Cannot convert the "Accept: application/json" value of type "system.string"..) as it is setup above (Powershell makes everything difficult), I looked up the Invoke-RestMethod command and came up with:
Invoke-RestMethod -uri https://vRAserver.company.org/identities/api/tokens -Method Post -Credential $cred -ContentType "application/json"
This seemed to do something, but I received an error message from my vRA server:
Invoke-RestMethod : HTTP Status 404 - /identities/api/tokens
At line:1 char:1
+ Invoke-RestMethod -uri https://vRAserver.company.com/identities/api/tokens -M ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
If I just try to browse to https://vRAserver.company.org/identities/api/tokens I get the same error....
Any suggestions? I can't even THINK about doing any queries of the data structures without being authorized with the token...is there some setup I need to do to initialize the REST API interface on the vRA appliance?
Roger