• Brock Peterson

Build and Rename VMs with VMware vRA!

Updated: Apr 27

If you've built VMs using vRA, you've likely noticed the naming convention, not ideal, let's change that. Out of the box, your deployments will look something like this in vSphere.

Neither the vSphere name nor the DNS name is super descriptive, but we can change this! We'll use an Extensibility Action and Subscription and a Customization Specification to define our new name. Let's start with the Extensibility Action, mine is called RenameVM.

My Action calls this Python Script to rename the VM. I loaded this template by clicking the LOAD TEMPLATE button and selecting the Rename VM template.

I adjusted the new_name to be assigned based on customProperties from the Cloud Template, which we will get to later. Once we've defined our Action, we must create a Subscription, such that our Action is run on certain conditions. Mine looks like this and is also called RenameVM.

Each time a Compute allocation event is seen, the Subscription will run the RenameVM Action we previously defined. You have the ability to enable/disable this Subscription, Block execution of events, and apply to Any project.


Let's adjust our Cloud Template to ask the user for input on VM hostname and rename as requested. Mine looks like this:

Now when I deploy, I'm asked what I'd like to name the VM.

Once deployed, it looks like this.

Almost there. Notice the DNS Name isn't quite what we want. We can adjust this with a Customization Specification. Mine looks like this:

Select Compute name and tell it to use the virtual machine name. Now, adjust your Cloud Template to use that Customization Specification, mine is called Windows Rename VM.

Now when we run a deployment, everything is renamed as desired!

So much we can do with vRA Cloud Templates, Extensibility Actions and Subscriptions, and Customization Specifications. For more information and trials on vRA, go here!


616 views0 comments

Recent Posts

See All