Automating Azure VM restore

  • 28 December 2022
  • 6 replies
  • 277 views

Badge +1

Hello Everyone,

Hope you are all doing well. Has anyone worked on restoring a full VM from Azure to Azure with Commvault using automation. Here’s our scenario, we have VMs in Azure and commvault backs them up in Azure (cold storage blob) and with commvault we have restored VMs in another vnet successfully. Now I am working on researching if we can automate most of the steps. We created an isolated environment in Azure thru terraform, so that’s automated, now I want to automate restores thru code either by workflow or scripting, has anyone done this before? Can someone please help me in this regards. Thank you.


6 replies

Userlevel 7
Badge +19

Hello Everyone,

Hope you are all doing well. Has anyone worked on restoring a full VM from Azure to Azure with Commvault using automation. Here’s our scenario, we have VMs in Azure and commvault backs them up in Azure (cold storage blob) and with commvault we have restored VMs in another vnet successfully. Now I am working on researching if we can automate most of the steps. We created an isolated environment in Azure thru terraform, so that’s automated, now I want to automate restores thru code either by workflow or scripting, has anyone done this before? Can someone please help me in this regards. Thank you.

Hi,

Yes, we have some experience with this. Please look into the Powershell or Python SDKs. In addition you could also look at the JSON body that is generated based on the recovery options that you specify when performing it via Command Center. This body can be used as an example and allow you to customize it as needed.

See for example: https://documentation.commvault.com/2022e/essential/101870_restore_cvvirtualmachine.html

The latest version of the Powershell SDK can be retrieved from https://www.powershellgallery.com/packages/CommvaultPowerShell

Good luck!

Badge +1

@Onno van den Berg Thank you so much for your response, I will go thru it and will bug you again if I need some help ;) Thank you again, Happy Holidays and A Happy New Year!!!

Userlevel 7
Badge +23

Hey @Shabbir 

I moved your question to a new topic in our developer/automation section so you can get the best possible responses.

Another (more legacy) way is to use the commcell console and when you get to the final restore screen, use “save as script” - that will generate a batch file with XML that can automate based on all your selections. You can use the XML as a template for other VMs or options - just another option!

Badge +1

Hello @Damian Andre,

Yes I did try the “save as script” from the commcell console out and it worked perfectly, my restores work without any errors. Can I add this script in the commvault workflow and schedule it to run every week to check for backup integrity? but I do need to check for recent backup to be restored every week. Thanks.

Userlevel 7
Badge +23

Hello @Damian Andre,

Yes I did try the “save as script” from the commcell console out and it worked perfectly, my restores work without any errors. Can I add this script in the commvault workflow and schedule it to run every week to check for backup integrity? but I do need to check for recent backup to be restored every week. Thanks.

Yes - I don’t have XML in-front to reference of me but if you remove any reference to browse start / end time then it should always pick the latest data to restore. You can put into a workflow using a qoperation → Execute block

 

Badge +1

Hello @Damian Andre,

Thanks a lot it works perfectly when I place the script in the qoperation → execute block.

 

To Everyone:

Now I am looking to send an email if it fails or succeeds, just playing with the work flow but it every time sends me a success email even thou the script fails to execute fully. I don’t know if someone else has run into this scenario. If yes, please share your experience. Thank you. :)

Reply