• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

virtuallyGhetto

  • About
  • Privacy
  • VMware Cloud on AWS
  • Home Lab
  • Nested Virtualization
  • Automation
    • VMware Kickstart
    • VMware API/SDK/CLI
    • VMware vMA/VIMA
    • VMware OVF / OVFTOOL
  • Apple Mac
  • VCSA
  • VSAN
You are here: Home / Automation / Automating VMware Site Recovery (DRaaS) with VMC

Automating VMware Site Recovery (DRaaS) with VMC

05/28/2019 by William Lam Leave a Comment

VMware Site Recovery provides customers with an easy and on-demand Disaster Recovery as-as-Service (DRaaS) for both their on-premises and VMware Cloud on AWS (VMC) workloads. DRaaS is one of the most popular VMware Cloud Service as it literally enables customers to setup a fully functional target DR site with just a click of a button, no joke!


As simple as this is, customers are also interested in automating the setup of DRaaS, especially for testing purposes. A couple of weeks back, I had a customer reach out asking if it was possible to automate the setup of DRaaS?

Funny enough, I just had this conversation a few weeks prior with the PM/Engineer and was in the process of looking into this. It turns out we do indeed have DRaaS Service API, which is what the VMC Console uses, however we had not publicized the API nor showed how to actually get more information about it. Do not worry, I have already feature request with the PM to not only get this published publicly but also show up as part of the VMC Developer Center API Explorer 🙂

The DRaaS Service API is pretty straight forward to use and there are only key three methods that are required for the basic DRaaS workflows. Below is a screenshot of the Swagger file, which can be downloaded using cURL as it requires authentication and you can use this shell script here to do so. Once downloaded, you can use any Swagger-based tool to view it, I use the Swagger Online Editor for this.


Rather than talking about how the DRaaS API works, lets take a look at an actual implementation! Similiar to VMC, VMC NSX-T and VMC HCX Community PowerCLI Module, I have also created a module for DRaaS which just contains three functions:

  • Connect-DRaas
  • Get-DRaas
  • Set-DRaas


For more details on how to use the DRaaS module, check out the tutorial below.

Step 1 - Download and import the VMC Community PowerCLI Module

Import-Module ./VMware.VMC.psd1

Step 2 - Connect to the VMC service and provide your VMC Organization Refresh Token, Name and SDDC Name by running the following commands:

$RefreshToken = "FILL-ME-IN"
$OrgName = "BashFest - Red Team"
$SDDCName = "SDDC-02"
Connect-VmcServer -RefreshToken $RefreshToken

Step 3 - Download and import the DRaaS Community PowerCLI Module and connect to the service by running the following commands:

Import ./VMware.DRaaS.psd1
Connect-DRaas -RefreshToken $RefreshToken -OrgName $OrgName -SDDCName $SDDCName

Step 4 - Once you have successfully connected, we can use the Get-DRaas function to get information about our DRaas deployment. If you have not activated DRaaS, you will get a message like the one shown below to use the Set-DRaas function to do so.

Get-DRaas


Step 6 - Lets go ahead and activate DRaas by using the Set-DRaas function and specify the -Activate flag by running the following command:

Set-DRaas -Activate


As shown in the output, this process will take some time as DRaaS will need to first connect to the DRaaS Content Library to import both the SRM/VR Virtual Appliance into your SDDC and then deploy and configure the appliances. You can use the VMC Console to monitor the progress, but we can also use the Get-DRaas function to do so which gives us more granular information about what is happening.


Simply re-run the Get-DRaas function and we can now see some useful information about the overall DRaaS state as well as the individual status for both the SRM and VR Nodes.


To determine when the deployment has completed, you will want to ensure that the DRaaSState is set to ACTIVATED and both the SRM and VR Node State have the READ value. In additon, you can also use this information to create Edge Firewall rules and retrieve the DRaaS URL for setting up SRM.


Step 7 - If you need to deactivate DRaaS for your SDDC, you simply use the Set-DRaas function but now specifying -Deactivate flag by running the following command:

Set-DRaaS -Deactivate


Similar to activate, we can also use the Get-DRaas function to monitor the progress of the deactivation.

More from my site

  • Quick Tip – Locating SRM Placeholder VMs using the vSphere API
  • Automating the silent installation of Site Recovery Manager 5.8 w/Embedded vPostgres DB
  • Automating the silent installation of Site Recovery Manager 6.0/6.1 w/Embedded vPostgres DB
  • Automating HCX Multi-Site Service Mesh configuration using the new HCX PowerCLI cmdlets
  • New VMC API to rename SDDC
Share this...
  • Twitter
  • Facebook
  • Linkedin
  • Reddit
  • Pinterest

Filed Under: Automation, PowerCLI, VMware Cloud on AWS Tagged With: DRaaS, site recovery manager, srm, VMC, VMware Cloud on AWS, VMware Site Recovery

Reader Interactions

Thanks for the comment! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Author

William Lam is a Staff Solution Architect working in the VMware Cloud on AWS team within the Cloud Platform Business Unit (CPBU) at VMware. He focuses on Automation, Integration and Operation of the VMware Software Defined Datacenter (SDDC).

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Sponsors

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy