Veeam Integration with vRA Part 2: Restore

In this 2 part series we will walk through integrating Veeam with vRealize Automation and vRealize Orchestrator. Part 1 focused on giving users the ability to add virtual machines to existing Veeam backup jobs from within the vRA self-service portal. In Part 2 we will add the ability to restore virtual machines from a list of available restore points in vRA. The versions used are Veeam 9.5 and vRA 7.2 / 7.3.

The steps outlined below assume that you have already installed and configured Veeam Backup and Replication, and vRealize Automation with either embedded or external vRealize Orchestrator instance, as well as having a basic knowledge of both areas. The following process and the sample workflows we will import are not endorsed by, or supported by Veeam. Finally, Veeam Enterprise Manager is required to use Veeam RESTful API. For further reading material see the Veeam RESTful API Reference here. Alternative sample workflows and reading provided by The IT Hollow here, and another useful article by vRatpack here with vRA 6.2.

Add the REST Host

If you have already added your Veeam backup server as a REST host in part 1 then skip this step. Otherwise, open the vRealize Orchestrator client and log in as an administrator, change the view to Design from the drop down menu. The first thing we will do is add the Veeam server as a REST host. From the Workflows tab expand Library, HTTP-REST, Configuration.


Right click Add a REST host and click Start workflow. Enter the name and URL of the Veeam server, the default URL uses port 9399, for example http://VeeamServer:9399. Review the default options and click Next.


Configure the host authentication options as required. Here I have used Basic authentication, and entered the credentials for a service account with administrative access to Veeam.


Configure proxy and advanced settings if required, then click Submit. The workflow will run and add the Veeam server as a REST host. There are also Update a REST host, and Remove a REST host, workflows if you want to make any changes. Existing REST hosts can be viewed from the inventory tab under expand HTTP-REST.

Import the Sample Workflows

If you have already imported the sample workflows in part 1 then skip this step. In this example I am using sample workflows provided here, again these are not supported by Veeam. Download and extract the ZIP file to a location accessible from the vRO client. Change to the packages tab and click the Import Package icon. When prompted browse to the downloaded package file and click Import.


Ensure all the required elements are included and click Import selected elements.


We have now imported the backup workflow and action, and the restore workflow and action. The final element is a settings file which we will use to determine the REST host. Open the configurations tab and expand Library, Veeam. Click the Settings file and the pencil icon to edit. Select Attributes and locate the restHost attribute, click the Not set value and expand HTTP-REST, select the Veeam server we added earlier from the list of REST hosts and click Select. Click Save and close. The value of the restHost attribute should now be the Veeam backup server.

The restore jobs users select from are pulled using the getVMRestorePoints action under com.veeam.library in the actions tab. If you want to examine the workflow in more detail go to the workflows tab and expand Library, Veeam. Select the Restore VM workflow and go through the tabs in the right hand pane. From the General tab you can see the restHost attribute is using the settings configuration file we have just configured. The Inputs for the workflow are Date (the Veeam restore point) and vmObj (virtual machine name). Under the Schema tab you can view the Scripting task which is making the API calls.


Update Sample Script

If you are using the sample script referenced in this post then there are further steps required to fix the date formatting with later versions of Veeam. If you are using alternative or custom workflows then the following is not required.

  • Edit the Restore VM workflow, open the Schema tab and click the Find Restore Point script. Update the date and time format on line 25 to: var rpDateLocale = System.getDateFromFormat(restorePointNodes.item(i).getElementsByTagName(“CreationTimeUTC”).item(0).textContent,”yyyy-MM-dd’T’HH:mm:ss.sss’Z'”).toLocaleString();


  • Edit the getVMRestorePoints action, open the Scripting tab. Update the date and time format on line 26 to: var rpDateLocale = System.getDateFromFormat(restorePointNodes.item(i).getElementsByTagName(“CreationTimeUTC”).item(0).textContent + ” UTC”,”yyyy-MM-dd’T’HH:mm:ss.sss’Z’ ZZZ”).toLocaleString();


  • You can test the API calls are successfully bringing back restore points by running the workflow in vRO and selecting a virtual machine, a list of available restore points should be displayed.


vRA Integration

The final step is to hook the vRO workflow into vRA. Log into the vRealize Automation portal as a user with service architect permissions. From the Design tab select XaaS and Resource Actions. Any existing resource actions are listed. Click New.


Map the resource action to the relevant vRO workflow. In this case we need to expand Library, Veeam and select the Restore VM workflow. Click Next.


The input mappings should already be populated; the resource type is IaaS VC Virtual Machine, the input parameter matches up with the parameter configured in the vRO workflow (vmObj which passes the virtual machine name), and this maps to the VC:VirtualMachine orchestrator type.


Accept the default values for the resource action form and click Finish.


The new resource action is now listed as a draft. To start using the action select it and click Publish.


Now select the Administration tab and Catalog Management. Open the Actions page, the new resource action we created should now be displayed.

If you want to change the icon of the resource action you can do so by selection the action and clicking Configure. There are a number of useful vRA icons available here, including sample icons for day 2 actions. Note for users of vRA 7.2 there is a known issue with changing the icon for custom actions, resolved in 7.3 as per this KB article.


The next step is to assign our custom action to an entitlement. Open the Entitlements page and select the relevant entitlement. Click the Items & Approvals tab, under Entitled Actions click the green plus symbol. Locate the new resource action and select the check box to add it to the entitled actions. Click Ok and Finish.


To confirm the configuration has worked browse to the Items tab and select Machines. Any virtual machines that have the custom resource action added to the entitlement will show the new action in the drop-down Actions menu.


When selecting the new action I am presented with the action form as per the design canvas we saw earlier. In this example I select the restore point from the drop-down list that the getVMRestorePoints vRO action has pulled from the Veeam backup server, and click Submit.


The virtual machine name is then passed through to the next stage of the workflow, along with the restore point ID. You can check the status of the job in vRA under the Requests tab, check the Restore VM workflow has run successfully in the vRO console, and check the restore task that will be running as normal in the Veeam Backup & Replication console.


Veeam Integration with vRA Part 1: Backup

Veeam Integration with vRA Part 2: Restore

1 thought on “Veeam Integration with vRA Part 2: Restore

  1. Xu

    Here are two questions to ask:
    Software Version:
    – vRealize Automation 7.3.5493918
    – vRealize Orchestrator
    – Veeam Backup Enterprise Manager
    – Veeam Backup & Replication Console
    – vCenter 6.0.0,2559267
    – VM Name : dev-163

    1. In Veeam, a “Backup Job 1″ is defined to be used to Backup the VM(dev-163), and to use” Veeam Backup & Replication Console “to perform” Backup Job 1″ is successful, and use vRealize Automation application.
    New Request “Add VM to Backup Job”, which is successful in Request, can also see a “Add VM to Backup Job” in vRealize Orchestrator.
    Execute log:
    [2018-01-09 03:45:00.670] [I] Opened REST Session: 6f3b216e-65a4-4165-8558-d75cf3608663
    [2018-01-09 03:45:00.696] [I] Job Name: Backup Job 1
    [2018-01-09 03:45:00.697] [I] Job ID: 45b4a816-d0f0-4eab-9f19-b52b67f2f35c
    [2018-01-09 03:45:00.713] [I] vSphere SDK UUID: d322b019-58d4-4d6f-9f8b-d28695a716c0
    [2018-01-09 03:45:00.728] [I] vSphere Heirarchy Root ID: 72448ed8-fd75-4cf4-9f19-2b59ee064d33
    [2018-01-09 03:45:00.729] [I] VM Name: dev-163
    [2018-01-09 03:45:00.730] [I] VM MoRefId: vm-748
    [2018-01-09 03:45:00.745] [I] VM “dev-163” added to job “Backup Job 1”
    [2018-01-09 03:45:00.769] [I] Closed REST Session: 6f3b216e-65a4-4165-8558-d75cf3608663

    However, there is no backup task execution within Veeam Backup & Replication Console.

    2.Use vRealize Automation to apply
    New Request “Restore VM” failed in Request, and a vRealize Orchestrator can also see a “Restore VM” workflow execution failed.
    Execute log:
    [2018-01-09 03:18:54.124] [I] Restore Point ID: null
    [2018-01-09 03:18:54.620] [E] Error in (Workflow:Restore VM / Restore VM via REST (item0)#18) TypeError: Cannot read property “textContent” from null
    [2018-01-09 03:18:54.655] [E] Workflow execution stack:
    item: ‘Restore VM/item0’, state: ‘failed’, business state: ‘null’, exception: ‘TypeError: Cannot read property “textContent” from null (Workflow:Restore VM / Restore VM via REST (item0)#18)’
    workflow: ‘Restore VM’ (46417b56-be0b-43de-908e-0eea7b0aa1cf)
    | ‘attribute’: name=restHost type=REST:RESTHost value=dunes://’25393010-e922-4854-9703-c8970b8379f1’&dunesName=’REST:RESTHost’
    | ‘attribute’: name=restorePointId type=string value=__NULL__
    | ‘attribute’: name=restoreSessionId type=string value=
    | ‘input’: name=Date type=string value=January 9, 2018 10:20:33 AM PST
    | ‘input’: name=vmObj type=VC:VirtualMachine value=dunes://’vcsa-01a.corp.local%2Cid:vm-748’&dunesName=’VC:VirtualMachine’
    | ‘attribute’: name=__asd_targetResourceInternalId type=string value=5c57ac94-082d-411c-954f-87ac39f8ee89
    | ‘attribute’: name=__asd_catalogRequestId type=string value=425375f9-75e1-4e92-8da0-e57c0986447f
    | ‘attribute’: name=__asd_subtenantRef type=string value=29a02ed9-7e63-4c77-8a15-c930afb0e3d8
    | ‘attribute’: name=__asd_requestedBy type=string value=jason@corp.local
    | ‘attribute’: name=__asd_requestedFor type=string value=jason@corp.local
    | ‘attribute’: name=__asd_targetResourceId type=string value=685fff5b-2c7b-424a-8d82-f6b90d25d7a9
    | ‘attribute’: name=__asd_tenantRef type=string value=vsphere.local
    | ‘attribute’: name=__asd_targetResourceTypeId type=string value=Infrastructure.Virtual
    | ‘attribute’: name=__asd_targetResourceProviderId type=string value=c1f91614-c60a-4502-8016-6a5cda9915d4
    | ‘no outputs’
    *** End of execution stack.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s