VMware Cloud Community
VMpalavsachin27
Contributor
Contributor

CloudClient - 4.2.0-4287344 Help

Team,

I need some assistance -

  • I submit a request for catalog as : vra catalog request submit --id catalog01 --groupid GRP-01 --reason AutomatedDeployment. this results requestID - 9c4e2297-7850-4dac-8545-52e0dbdbde5f

Now how do I find out the

  1. VMName which was created for this requestID
  2. VM IPAdddress of this VM

And all these commands should be such that they should work on userRole.

I checked the documentation but that really is not having details, so any help in this will really be a life saver

Thanks

Sachin Palav

2 Replies
kallischlauch
Enthusiast
Enthusiast

Heya,

my initial thought was vra request detail --id 9c4e2297-7850-4dac-8545-52e0dbdbde5f -- but that doesn't really provide the info you'd expect, maybe only in my case .. gove it a try

maybe also if you find deployment id (if not even same as request id), maybe that can work: vra deployment detail --id 9c4e2297-7850-4dac-8545-52e0dbdbde5f ???


there's probably a way to do it with cloudclient only, but I needed something similar couple of months back and utilised PowerVRA for help (GitHub - jakkulabs/PowervRA: vRealize Automation PowerShell Toolkit)

##powervra machine request looks like this in PowerShell

Connect-VraServer <server and credentials)

$CatalogItemId = (Get-vRAConsumerCatalogItem -Name $bluePrintName).Id

$Request=Request-vRAConsumerCatalogItem -Id $CatalogItemId -Wait -Verbose -Confirm:$false

#this is how you can find machine name. IP should be similar (however there might be multiple)

#as you can see I'm not using an array here, so it assigns $machinename to be the name of any VM it finds (and keeps re-assigning if there are multiple). I just needed any, thats why i id not change it. but it demonstrates how you can use it.

foreach($deployeditem in $Request){if ($deployeditem.ResourceType -eq "Infrastructure.Virtual"){$machinename = $deployeditem.Name}}

also if you have the machine name, with cloudclient you can find specific properties of a VM (exported as JSON):

cloudclient.bat vra machines detail --id $machineName --format JSON --export $exportPath

0 Kudos
VMpalavsachin27
Contributor
Contributor

I got help from the VMware Support :

Here is the update :

  1. Submit the request using cloudclient

- Execute command: vra catalog request submit --id catalog01 --groupid GRP-01 --reason "This is cli" --leasedays 3 --cpu 2 --memory 7000

  1. Get status of the above Service Request submitted using cloudclient
    - The status of request could be fetched from command: "vra request detail --id REQUEST_ID" (use the request ID fetched from above command). Field 'state' needs to be taken in to consideration here.
  2. Get the VMName, IPAddress provisioned VM from above service request using cloudclient
    - Execute command: "vra machines list --requestId REQUEST_ID", from here read the value for "catalogResource.id" for Machine ID and "name" for VM Name.
    - Execute command: "vra machines detail --id catalogResource.id". Here you can read field "__datacollected_ipaddress" to read VM's IP Address and other details.
  3. Destroy/Delete VM created from the above service request.
    - Execute command: "vra machines action execute --id catalogResource.id --action Destroy". This command will delete VM from vRA and also from vCenter.

Thanks to the support team.

I am posting this in this thread so that will help others as well.

Thanks to the support team again, appreciated.

Regards

Sachin Palav