Reader small image

You're reading from  Mastering PowerCLI

Product typeBook
Published inOct 2015
Reading LevelIntermediate
PublisherPackt
ISBN-139781785286858
Edition1st Edition
Languages
Right arrow
Author (1)
Sajal Debnath
Sajal Debnath
author image
Sajal Debnath

Sajal Debnath is a highly certified Cloud computing technocrat with more than 12 years of experience in virtualized data center design, Cloud computing, and BC/DR solutions. He is an EMCISA, VCAP-DCD/DCA, VCAP-CID/CIA, RHCE 4/5/6, RHCVA, Openstack, and ITIL certified person. He is presently associated with VMware Software India Pvt. Ltd. as a senior system engineer. Previously, he worked with France Telecom, Hewlett Packard, and many more in multiple roles. He is involved in prestigious Indian government projects, such as National Cloud, Digital Locker, and so on.
Read more about Sajal Debnath

Right arrow

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")

Note the Authorization parameter; there needs to be a space between bearer and token. Next, get the information:

PS C:\> Invoke-RestMethod -Method Get -Uri 
"https://vra.lab.com/identity/api/tenants" -Headers $headers | FL

Putting...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering PowerCLI
Published in: Oct 2015Publisher: PacktISBN-13: 9781785286858

Author (1)

author image
Sajal Debnath

Sajal Debnath is a highly certified Cloud computing technocrat with more than 12 years of experience in virtualized data center design, Cloud computing, and BC/DR solutions. He is an EMCISA, VCAP-DCD/DCA, VCAP-CID/CIA, RHCE 4/5/6, RHCVA, Openstack, and ITIL certified person. He is presently associated with VMware Software India Pvt. Ltd. as a senior system engineer. Previously, he worked with France Telecom, Hewlett Packard, and many more in multiple roles. He is involved in prestigious Indian government projects, such as National Cloud, Digital Locker, and so on.
Read more about Sajal Debnath