vRealize Automation 7 – Custom Actions
February 15, 2016We’ve deployed a virtual machine from a vRA blueprint, but we still have to manage that machine. One of the cool things we can do with vRealize Automation 7 is to add a custom action. This takes the virtual machine object and runs a vRealize Orchestration blueprint against that input. We call these actions “Day 2 Operations” since they happen post provisioning.
To create a new custom resource action go to the Design Tab –> Design –> Resource Actions. Click the “New” button to add a new action.
Select the Orchestrator workflow from the list.
The vRO workflow should have an input parameter that can be passed from a server blueprint. I’m using a VC:VirtualMachine parameter because I know it will identify the virtual machine and is passed automatically.
On the Input Resource tab, select the IaaS VC Virtual Machien as the resource type and the Input Parameter should be filled in already.
On the details tab enter the name and a description. The Type in my case is blank because i’m not using it for provisioning or deprovisioning.
Change the form to match your requirements. I like to keep the form as empty as possible so that users are able to request the action from a blueprint and vRO attributes fill in the rest.
When you’re done, be sure to “Publish” the blueprint so that it can be used.
Now we need to configure the action, much like we’ve configured our catalog items in a previous post.
Give the action an icon and click Finish.
Now, when we provision a virtual machine, we can see the Action that we created in our list. We can now run this action from the Items screen.
Summary
Custom Actions are a great way to allow our users to manage their own resources after they’ve provisioned them. Since its a vRealize Orchestrator workflow, we can use these actions to put guardrails on actions to protect users from themselves. For instance maybe we replace the “Snapshot” action with a custom action that also deletes the snapshots after 3 days. It certainly can reduce helpdesk tickets that come in and ask for a snapshot to be taken.
[…] Part 17 – Resource Actions […]
Hi Eric,
If I want to do the same for the actual deployment – i.e blueprint / multi machine blueprint, what resource type should the vro workflow has as input ?
Thanks
You can build an XaaS blueprint to call other blueprints if you want.
The inputs in that case would be dependent upon what criteria you’d be collecting from the user.
Hi Ben,
Have you by chance created a XaaS BP for multi machine blueprint? If you have anything you could share with me would be awesome. I’m looking into this and not finding much on it.
Thanks
Hi,
Great articles, thanks for sharing!
I’m just starting out with vRa7, looking at adding a custom action, when I get to the Input Resource, there are no input types available in the drop down. I was expecting to see the built in types for vm’s etc.
Any ideas?
You want your vRO workflow to have an input type of VC:VirtualMachine so that when you execute it, vRA will pass the machine parameter over to vRO to be executed.
NICE
You can also create resource mapping to suit your requirement.
I’m attempting to create a Resource action to destroy AD computer account that is triggered upon Disposal. I have created a custom resource ‘AD:ComputerAD’ to link the resource action with. Upon creating these two items, Do I have to entitle it or does this become a global resource action for any Disposal that occurs.
Thank you!
To make the Resource Action available in the portal, you must entitle it.
However, if you want this to be done automatically at de-provisioning time, you want to use an event subscription to call a vRO workflow and not a Resource Action. Resource Actions are only used for manual operations during the machine’s lifecycle.
Actually, I do have to entitle the action, which I have done. I performed a destroy action of the VM. The event log does not show any attempt to delete the AD computer account. Should I set this up as a subscription instead? Thanks!
Still trying to figure out what to use when!
Yeah if you want that to happen when you destroy a machine. You won’t use a resource action. You are looking for an event subscription.
Resource Actions are for someone to manually push a button. Events happen in response to other actions like “destroying” a machine.
Ah..That is exactly what I’m looking for, what gets used when..etc. I’m trying to determine the proper Event Topic and condition settings for this situation. It appears I should use Event Topic: Component Action completed (or requested).
For the condition, I’m not clear but I’m wondering if this woould work:
Condition: Event type Equals constant:’destroy’
I’m fairly new to vRA and have walked through some of the Hands On Labs, but they don’t get down to what to use when, etc.
I really appreciate your assistance!
Thanks,
Jerry
Try this for a subscription:
Event Topic: Machine Provisioning
Lifecycle State name: VMPSMasterWorkflow32.Disposing
Lifecycle State phase: PRE
Eric,
That worked exactly as expected.
Thanks so much!
I have created Resource Action called Deallocate Virtual Machine using Inbuilt Workflow”Deallocate Azure Virtual Machine” provided by VMware; and entitled to Azure Blueprint; When I click on resource action it is giving error as “Service Not found If the problem persists contact System Administrator”; Could you check the same from your end.
I have created a Resource Action and assigned an Orchestrator workflow to it.
The Resource action works but I cannot view or edit the workflow that is assigned to the Resource Action.
When I edit any resource action I can only see the tabs Details and Form. The workflow and Input Resource tabs are not displayed.
I am logged in using the same account I used t create the action with tenant and fabric admin rights
Great Article!
I am just starting with vRA. I follow up your steps and looks like vRA has passed something below to my vRO workflow.
_asd_targetResourceInternalID
_asd_catalogRequestID
…
…
_asd_targetResourceID
…
_asd_resourceProvidedID
But I still can’t get the hostname and IP of my ptovisioned vm. Could you please suggest how i can get hostname and IP of vm?
I assume this is related to a custom action? The parameters passed to vRO will depend on the item in vRA. If it’s a VMware virtual machine the VC:VirtualMachine parameters should be passed which will have your host info in it.
If this is not a custom action, then are you using event subscriptions or stubs? Have you added the correct custom property to pass additional info over to vRO during the events? See: https://theithollow.com/2016/02/10/vrealize-automation-7-custom-properties/