Product

Advanced Protection for vCD with Rubrik and PowerShell

Rubrik - Advanced Protection for vCD with Rubrik and PowerShell - Advanced Protection for vCD with Rubrik and PowerShell

Hot off the announcement of being VMware certified for vCloud Director (vCD), we have two more exciting capabilities for our vCD users. First, we have added extensive support for vCD to our PowerShell SDK. Second, our Andes 5.1 release includes the ability to protect vCD Templates in a manner similar to our existing vCD vApp protection. This post will explore both of these new features.

PowerShell SDK Updates

Since its release, the Rubrik SDK for PowerShell has been a powerful and popular tool for managing day-to-day data protection tasks. Adding the ability to manage vCD protection via our SDK allows users and administrators to script protection and recovery tasks by providing reliable, repeatable automation of otherwise tedious workflows. Here are the newest cmdlets:

  • Export-RubrikVApp: Exports a snapshot from a protected vApp to a new or existing vApp.
  • Export-RubrikVCDTemplate: Exports a snapshot from a protected vCD Template to a catalog.
  • Get-RubrikVApp: Provides information about a vApp, including ID and assigned SLA Domain.
  • Get-RubrikVCD: Provides information about vCD instances connected to Rubrik.
  • Get-RubrikVAppExportOptions: Provides metadata needed to perform a vApp export.
  • Get-RubrikVAppRecoverOptions: Provides metadata needed to perform a vApp recovery.
  • Protect-RubrikVApp: Assigns or removes an SLA Domain from a vApp.
  • Restore-RubrikVApp: Performs a Partial or Full Instant Recovery for a protected vApp.
  • Set-RubrikVCD: Adjusts configuration settings for a vCD instance connected to Rubrik.
  • Update-RubrikVCD: Triggers Rubrik to perform a metadata update from vCD.

In addition to the new cmdlets, Get-RubrikSnapshot and New-RubrikSnapshot work as expected when provided a vApp ID. This provides users and admins a toolset that is very similar to the one used for other common Rubrik tasks. Let’s take a look at a few of these new cmdlets in action. Note that some output has been removed for the sake of readability and brevity.

Get-RubrikVApp

Get-RubrikVApp returns information about a vCD vApp, very similar to the way Get-RubrikVM works for VMs. This is a typical starting point for users to gather the information needed to perform further tasks, like assigning an SLA Domain or querying for snapshot information. Note the vApp ID returned in the results below, which is used in later examples.

Example

Result

If you have already used the PowerShell SDK to interact with VMs, this output should look very familiar. As you can see, the cmdlet searches for a vApp named “Demo-vApp01,” and by specifying only -PrimaryClusterID local return results from the local cluster (i.e. results from replicated vApps are omitted). 

Protect-RubrikVApp

As you can see from the output above, “Demo-vApp01” is assigned to the “Gold” SLA Domain. Changing the SLA is simple with the Protect-RubrikVApp cmdlet. For example, if I wanted to change the SLA Domain from Gold to Bronze, I would use the command below.

Example

Result

Export-RubrikVApp

Now that the appropriate SLA Domain is assigned to the “Demo-vApp01” vApp, an export can be performed. Similar to when using the Rubrik CDM UI, there are many different parameters available when performing a vApp export. The following example demonstrates a scenario in which a full vApp is exported to the same Org vDC. The cmdlet help can be used for additional examples, such as exporting a partial vApp, or exporting to an alternate Org vDC.

Example

This example uses Get-RubrikSnapshot to determine the ID of the most recent snapshot before executing Export-RubrikVApp. Specifying ExportToNewVapp creates a new vApp, as opposed to exporting the underlying virtual machines into the existing vApp. The NoMapping parameter is one of a few different parameters that changes the networking settings of an exported vApp. Network interfaces are mapped, or connected, to a specific network. NoMapping removes the mapping between existing VM network interfaces and their connected networks. The result is that the vApp network interfaces are no longer connected to any network, and the administrator can set the desired network mapping once the export completes. This prevents IP conflicts, as well as errors when exporting to a new vApp that does not have any previous network configuration. There are also options to retain the network mapping but disconnect the network interfaces (DisableNetwork), or remove the network interfaces altogether (RemoveNetworkDevices).

The result returned is an ID for the export task, along with a URL that can be used to query Rubrik for the status of the task. This information can be passed to Invoke-RubrikRESTCall to programmatically monitor the progress of the export, if desired.

Protecting vCD Templates

Creating new vApp templates can be complicated and time consuming. Organizations who have built out several templates want to ensure that their hard work is protected. As mentioned, Rubrik’s Andes 5.1 release introduces the ability to protect and restore vCD Templates. Protection is as easy as assigning an SLA Domain to the template and is performed in the same manner as protecting a non-Template vApp. At the moment, this functionality is only available by using our API, but using the PowerShell SDK simplifies this. 

When using Get-RubrikVApp with Rubrik Andes 5.1, additional information is returned, allowing you to quickly discern whether or not a vApp is a template. Below is the result from running Get-RubrikVApp -Name ‘CentOS7_min’.

Result

The property isTemplate set to “True” indicates that this is a template. In this example, no SLA Domain has been assigned to this template, so the Protect-RubrikVapp cmdlet can be used to assign one.

Example

Recovering Templates via Export

To recover a template, perform an export of the desired template to a new or existing catalog. Exporting templates is accomplished with the Export-RubrikVcdTemplate cmdlet. By default, the template is exported to the same catalog it currently resides in. To export to a different catalog, you will need to specify a catalog ID. Invoke-RubrikRESTCall can be used to find the ID for the desired catalog from the vcd/hierarchy/{id}/children API endpoint.

Example

Result

The results from Invoke-RubrikRESTCall are used to find the object where “objectType” is equal to “Catalog” and “Name” is equal to “Templates.” The returned information provides the ID of the desired catalog, which can then be used with Export-RubrikVcdTemplate to recover the template.

Example

Similar to a non-Template vApp, Get-RubrikSnapshot is used to get the most recent snapshot ID for the specific Template, and then passed to Export-RubrikVcdTemplate along with the previously determined catalog ID. The exported template in the example command is named “CentosNew.” The returned result is identical to the ID and URL information returned when using Export-RubrikVApp. As seen in the following screenshot, once the export has succeeded, it is visible in the Template Library.

vCloud Director protection with PowerShell and Rubrik

If you’re interested in integrating this functionality with a non-PowerShell toolset, browse our API documentation and look for the /vcd/vapp/template/snapshot/{id}/export endpoint. This, along with vcd/vapp/template/snapshot/{id}/export/options and vcd/hierarchy/{id}/children will allow you to restore a vCD template.

Conclusion

The recent PowerShell SDK updates, along with new functionality arriving in Rubrik Andes 5.1, further solidifies Rubrik’s position as a top-tier solution for protecting vCloud Director. Please take a moment to follow both @rubrikInc and @RubrikBuild on Twitter to stay up to date with announcements on our vCloud Director integration, as well as other exciting new features and integrations!