Automated vRealize Automation Deployments : Solution Design : 2.7 PowerShell Script Configuration : 2.7.2 Environment Variables
   
2.7.2 Environment Variables
Because the successful configuration of vRealize Automation uses different CloudClient credentials for different tasks, these settings must be updated during the execution of the script for some commands.
One example of when updating the environment variables is necessary is using CloudClient for the addition of an identity source:
vra tenant identitystore add
or updating the infrastructure admin role membership:
vra tenant admin update
These CloudClient commands require the administrator@vpshere.local account. To set the update environment variables of the PowerShell script with the correct values, the following lines can be inserted in to the script to update the credentials used with CloudClient:
1. $env:CLOUDCLIENT_SESSION_KEY="administrator"
2. $env:vra_server="vra01.corp.local"
3. $env:vra_username="administrator@vsphere.local"
4. $env:vra_tenant="vsphere.local"
5. $env:vra_password="VMware1!"
With the environment variables updated to the administrator@vsphere.local credentials, the above-mentioned CloudClient commands can be successfully executed within the PowerShell script.
Remember, other CloudClient commands need Tenant Admin, Infrastructure Admin, or Infrastructure Architect roles. To change the environment variables to an account with the appropriately applied roles, add a section to the script updated with the new values:
1. $env:CLOUDCLIENT_SESSION_KEY="configurationadmin"
2. $env:vra_server="vra01.corp.local"
3. $env:vra_username="configurationadmin@vsphere.local"
4. $env:vra_tenant="vsphere.local"
5. $env:vra_password="VMware1!" 
In this example, the environment variables have been updated with the credential values for the configrationadmin@vsphere.local configurationadmin@vsphere.localaccount.