VMware Cloud Community
Psel10
Contributor
Contributor

vRA 8 Update VM Notes field in vCenter

In previous versions of vRA when a machine was deployed it would take the description field from the blueprint request form and put this into the Notes field of the VM in vCenter.  Or if the description was left blank the notes would say something along the lines of "Provisioned by VMware vRA"

In vRA 8.2 this doesn't seem to work for me anymore.  Is there a property that I need to add to the cloud template to bring this over?

0 Kudos
3 Replies
j_dubs
Enthusiast
Enthusiast

We have found the same.

In our case, we used the default description field and bound it to hidden field on the form and set as a property on the vm.

Called out via ABX to set the VM notes (in our case, vRO workflow to grab the description and update the notes field directly.)

0 Kudos
caduncan
Enthusiast
Enthusiast

Hi All!

We have the same issue. I was able to create an ABX PowerShell action that filled in the VM Notes in vCenter.

Used the following code:

function handler($context, $inputs) {
$vchost = $inputs.vcmgr
$vcuser = $context.getSecret($inputs.vcenterUser)
$vcword = $context.getSecret($inputs.vcpasswd)
# Created action secrets and placed in the default inputs

$vmname = $inputs.resourceNames[0]

# vmdescription is input from the cloud template/blueprint
$vmnotes = $inputs.customProperties.vmdescription

Connect-VIServer -Server $vchost -User $vcuser -Password $vcword -force

Set-VM $vmname -Notes $vmnotes -Confirm:$false

Disconnect-VIServer -Server $vchost -Confirm:$false

return

}

 

The subscription is setup as:

Event Topic: Compute post provision
filter events:
action: selecct action name
Condition: event.data.blueprintId == '<enterblueprintid>'
blocking enabled

Hope this helps.

j_dubs
Enthusiast
Enthusiast

Update on this - if you still want to work with fields that are set on the deployment level in your vRO workflows - in vRO 8.3+ you can use the new cloud plugin and perform REST API calls fairly easily.

We updated ours to remove the custom property on the VM, and pull just the deployment description.  Below is an action 

 

inputs:
(string) deploymentId

// name of your CSP endpoint in the inventory - they hard code 'VMware Cloud Services' in the plugin)
(string) csp_endpoint_name  

// You will get all the properties from a deployment and can access them your usual ways
return: Properties

//usage
deploymentDescription = (System.getModule("myModule").getDeployment(deploymentID,null)).description;



action code (myModule.getDeployment):

System.log("DeploymentId = " + deploymentId);
// Retrieve the current projectName from VMware Cloud
var epname = csp_endpoint_name || "VMware Cloud Services"
var endpoint = CloudEndpointManager.getEndpoint(epname);

if (endpoint) {
	var request = new CloudRequest();
	request.setEndpoint(endpoint);
	request.setPath("/deployment/api/deployments/" + deploymentId ); //API for deployment   /deployment/api/deployments/:depId
	request.setHttpMethod("get");
	var response = CloudRequestExecutor.execute(request);
	var responseAsJson = response.contentAsString;
	System.log(responseAsJson);
	var parsedJson = JSON.parse(responseAsJson);
	
    return parsedJson;
} else {
    System.log("Cannot find the default cloud endpoint [" +  epname + "]"); 
    return new Properties();
}