Create and customize recovery plans

This article describes how to create and customize a recovery plan in Azure Site Recovery. Before you start, learn more about recovery plans.

Create a recovery plan

  1. In the Recovery Services vault, select Recovery Plans (Site Recovery) > +Recovery Plan.
  2. In Create recovery plan, specify a name for the plan.
  3. Choose a source and target based on the machines in the plan, and select Resource Manager for the deployment model. The source location must have machines that are enabled for failover and recovery.

    Failover Source Target
    Azure to Azure Azure region Azure region
    VMware to Azure Configuration server Azure
    Physical machines to Azure Configuration server Azure
    Hyper-V managed by VMM to Azure VMM display name Azure
    Hyper-V without VMM to Azure Hyper-V site name Azure
    VMM to VMM VMM friendly name VMM display name

    Note

    A recovery plan can contain machines with the same source and target. VMware and Hyper-V VMs managed by VMM can't be in the same plan. VMware VMs and physical servers can be in the same plan, where the source is a configuration server.

  4. In Select items virtual machines, select the machines (or replication group) that you want to add to the plan. Then click OK.

    • Machines are added default group (Group 1) in the plan. After failover, all machines in this group start at the same time.
    • You can only select machines are in the source and target locations that you specified.
  5. Click OK to create the plan.

Add a group to a plan

You create additional groups, and add machines to different groups so that you can specify different behavior on a group-by-grou basis. For example, you can specify when machines in a group should start after failover, or specify customized actions per group.

  1. In Recovery Plans, right-click the plan > Customize. By default, after creating a plan all the machines you added to it are located in default Group 1.
  2. Click +Group. By default a new group is numbered in the order in which it's added. You can have up to seven groups.
  3. Select the machine you want to move to the new group, click Change group, and then select the new group. Alternatively, right-click the group name > Protected item, and add machines to the group. A machine or replication group can only belong to one group in a recovery plan.

Add a script or manual action

You can customize a recovery plan by adding a script or manual action. Note that:

  • If you're replicating to Azure you can integrate Azure automation runbooks into your recovery plan. Learn more.
  • If you're replicating Hyper-V VMs managed by System Center VMM, you can create a script on the on-premises VMM server, and include it in the recovery plan.
  • When you add a script, it adds a new set of actions for the group. For example, a set of pre-steps for Group 1 is created with the name Group 1: pre-steps. All pre-steps are listed inside this set. You can add a script on the primary site only if you have a VMM server deployed.
  • If you add an manual action, when the recovery plan runs, it stops at the point at which you inserted the manual action. A dialog box prompts you to specify that the manual action was completed.
  • To create a script on the VMM server, follow the instructions in this article.
  • Scripts can be applied during failover to the secondary site, and during failback from the secondary site to the primary. Support depends on your replication scenario:

    Scenario Failover Failback
    Azure to Azure Runbook Runbook
    VMware to Azure Runbook NA
    Hyper-V with VMM to Azure Runbook Script
    Hyper-V site to Azure Runbook NA
    VMM to secondary VMM Script Script
  1. In the recovery plan, click the step to which the action should be added, and specify when the action should occur: a. If you want the action to occur before the machines in the group are started after failover, select Add pre-action. b. If you want the action to occur after the machines in the group start after failover, select Add post action. To move the position of the action, select the Move Up or Move Down buttons.
  2. In Insert action, select Script or Manual action.
  3. If you want to add a manual action, do the following" a. Type in a name for the action, and type in action instructions. The person running the failover will see these instructions. b. Specify whether you want to add the manual action for all types of failover (Test, Failover, Planned failover (if relevant)). Then click OK.
  4. If you want to add a script, do the following: a. If you're adding a VMM script, select Failover to VMM script, and in in Script Path type the relative path to the share. For example, if the share is located at \\MSSCVMMLibrary\RPScripts, specify the path: \RPScripts\RPScript.PS1. b. If you're adding an Azure automation run book, specify the Azure Automation Account in which the runbook is located, and select the appropriate Azure Runbook Script.
  5. Run a test failover of the recovery plan to ensure that the script works as expected.

Watch a video

Watch a video that demonstrates how to build a recovery plan.

Next steps

Learn more about running failovers.