Automated vRealize Automation Deployments : Solution Design : 2.7 PowerShell Script Configuration : 2.7.5 vRealize Automation API
   
2.7.5 vRealize Automation API
There are some circumstances where it is necessary to use direct API commands against the vRealize Automation instance for configuration tasks. One area in which this is required is the update of role assignments. As of CloudClient 4.2, the support role updates consist of IAAS administrator, tenant administrator, service architect and approval administrator. For management of certain tenant items such as blueprints, users require the infrastructure architect role, which for the purposes of this document, is enabled with the API.
By using the “Invoke-RestMethod” PowerShell commandlet, the script can be configured to update the infrastructure architect role (listed as the COMPOSITE_SERVICE_INFRASTRUCTURE ARCHITECT role in the API) to add the new user or group.
Interacting directly with the vRealize Automation API requires authentication to obtain a bearer token. This token is used to provide that operations executed through the API are authorized.
The following code snippet demonstrates how to use PowerShell to obtain a bearer token and execute a REST API call.