Requesting Basic Catalog Items with PowervRA
• Craig
Requesting a vRA catalog item is simple with PowervRA and can be achieved with the Request-vRAConsumerCatalogItem cmdlet. Here are a few examples using an imaginary catalog item called centos.
Basic Requests
To get going you will need the id of the catalog item that you want to request. If you don’t already have it you can grab it with Get-vRAConsumerCatalogItem.
$CatalogItemId = (Get-vRAConsumerCatalogItem -Name centos).Id
Request-vRAConsumerCatalogItem -Id $CatalogItemId
The above command will return the id of the request which can be retrieved with Get-vRAConsumerRequest.
Wait
Alternatively, you can use the Wait
switch. This will tell the cmdlet to wait until the request completes. Adding the Verbose
switch to the mix will give you an idea what is going on behind the scenes.
$CatalogItemId = (Get-vRAConsumerCatalogItem -Name centos).Id
Request-vRAConsumerCatalogItem -Id $CatalogItemId -Wait -Verbose
This can easily be condensed down in to a one liner:
Request-vRAConsumerCatalogItem -Id (Get-vRAConsumerCatalogItem -Name centos).Id -Wait -Verbose
Request Properties
Request-vRAConsumerCatalogItem currently provides the ability to interactively set the RequestedFor, Description and Reasons properties. However if you need to go one step further you can use Get-vRAConsumerCatalogItemRequestTemplate. This cmdlet will retrieve a JSON template containing all of the parameters needed to make the request. By using Out-File it can be saved to disk which enables you to make further customisations before submitting it.
Get-vRAConsumerCatalogItemRequestTemplate -Name centos | Out-File requestTemplate.json
Get-Content -Path requestTemplate.json -Raw | Request-vRAConsumerCatalogItem