WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
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 // 2 Comments

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 - 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 - Install the DRaaS Community PowerCLI Module and connect to the service by running the following commands:

Install-Module VMware.DRaaS
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

  • Automating the new VMware Cloud Notification Gateway (NGW) User Notification Preferences
  • Integrating VMware Cloud Notification Gateway with VMware Event Broker Appliance (VEBA)
  • Custom notification and automation based on host failure in VMware Cloud on AWS
  • ESX 3.x on VMware Cloud on AWS? 
  • Configuring Standalone vRealize Orchestrator with VMware Cloud on AWS

Categories // Automation, PowerCLI, VMware Cloud on AWS Tags // DRaaS, site recovery manager, srm, VMC, VMware Cloud on AWS, VMware Site Recovery

Comments

  1. *protectedTim Goodrich says

    07/15/2020 at 2:42 pm

    Hi William, I'm a VMware TAM for a new VMC customer. Trying to get this to work, hoping to be able to use SRM cmdlets with an SRM/VMC Pair. When we run the connect-draas command, we get the error 'the path variable {org} has not been resolved. All of the variables appear to be correct per your instructions above. Any thoughts? Thank you!

    Reply
    • lamw says

      07/15/2020 at 2:55 pm

      I suspect this has to do with how you created your Refresh Token assuming the other variables are correct. Did you select "Organization Owner" when creating the scoped token including VMware Cloud on AWS "Administrator" and "NSX Cloud Admin" service role?

      Reply

Thanks for the comment!Cancel reply

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

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

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

Copyright WilliamLam.com © 2025

 

Loading Comments...