Managing tenants

Since we have the token, we can start exploring the vRA environment. We will start by managing the tenants. First, let's get a list of existing tenants. From now onwards, we need to provide authorization for working with the resources. Since we already have a token, we need to pass the authorization as a parameter in the header itself. We will use the following format:

Authorization: Bearer $token

Here, $token holds the authorization token. For this, we will build out the header. So, define a new object:

PS C:\>$headers = New-Object 
"System.Collections.Generic.Dictionary[[String],[String]]"

Next, add the components of the header:

PS C:\> $headers.Add('Accept', 'application/json')
PS C:\> $headers.Add('Authorization', "Bearer $token") ...

Get Mastering PowerCLI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.