Move an Azure Spring Apps service instance to another region

Note

The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.

This article applies to: ✔️ Basic/Standard ✔️ Enterprise

This article shows you how to move your Azure Spring Apps service instance to another region. Moving your instance is useful, for example, as part of a disaster recovery plan or to create a duplicate testing environment.

You can't move an Azure Spring Apps instance from one region to another directly, but you can use an Azure Resource Manager template (ARM template) to deploy your instance to a new region. For more information about using Azure Resource Manager and templates, see Quickstart: Create and deploy ARM templates by using the Azure portal.

Before you move your service instance, consider the following limitations:

  • Different feature sets are supported by different pricing plans (SKUs). If you change the SKU, you may need to change the template to include only features supported by the target SKU.
  • You might not be able to move all subresources in Azure Spring Apps using the template. Your move may require extra setup after the template is deployed. For more information, see the Configure the new Azure Spring Apps service instance section of this article.
  • When you move a virtual network (VNet) instance, you must create new network resources. For more information, see Deploy Azure Spring Apps in a virtual network.

Prerequisites

Export the template

Use the following steps to export the template:

  1. Sign in to the Azure portal.
  2. Select All resources in the left menu, and then select your Azure Spring Apps instance.
  3. Under Automation, select Export template.
  4. Select Download on the Export template pane.
  5. Locate the .zip file, unzip it, and get the template.json file. This file contains the resource template.

Modify the template

Use the following steps to modify the template.json file. In the following examples, the new Azure Spring Apps instance name is new-service-name. The previous instance name is old-service-name.

  1. The following example shows how to change all name instances in the template from old-service-name to new-service-name:

    {
        "type": "Microsoft.AppPlatform/Spring",
        "apiVersion": "{api-version}",
        "_comment": "the following line was changed from 'old-service-name'",
        "name": "[parameters('new-service-name')]",
        ….
    }
    
  2. The following example shows how to change the location instances in the template to the new target location:

        {
            "type": "Microsoft.AppPlatform/Spring",
            "apiVersion": "{api-version}",
            "name": "[parameters('new_service_name')]",
            "_comment": "the following line was changed from 'old-region'",
            "location": "{new-region}",
            …..
        }
    
  3. If the instance you're moving is a virtual network instance, the following example shows how to update the target virtual network resource parameters instances in the template:

    "parameters": {
        …
        "virtualNetworks_service_vnet_externalid": {
            "_comment": "the following line was changed from 'old-vnet-resource-id'",
            "defaultValue": "{new-vnet-resource-id}",
            "type": "String"
        }
    },
    

    The following example shows how to make sure the serviceRuntimeSubnetId and appSubnetId subnets exist. The subnets are defined in the networkProfile service:

    {
        "type": "Microsoft.AppPlatform/Spring",
        "apiVersion": "{api-version}",
        "name": "[parameters('Spring_new_service_name')]",
        …
        "properties": {
            "networkProfile": {
                "serviceRuntimeSubnetId": "[concat(parameters('virtualNetworks_service_vnet_externalid'), '/subnets/apps-subnet')]",
                "appSubnetId": "[concat(parameters('virtualNetworks_service_vnet_externalid'), '/subnets/service-runtime-subnet')]",
            }
        }
    }
    
  4. If any custom domain resources are configured, create the CNAME records as described in Tutorial: Map an existing custom domain to Azure Spring Apps. Make sure the record name is expected for the new service name.

  5. The following example shows how to change all relativePath instances in the template properties for all app resources to <default>:

    {
        "type": "Microsoft.AppPlatform/Spring/apps/deployments",
        "apiVersion": "{api-version}",
        "name": "[concat(parameters('Spring_new_service_name'), '/api-gateway/default')]",
        …
        "properties": {
            "active": true,
            "source": {
                "type": "Jar",
                "_comment": "the following line was changed to 'default'",
                "relativePath": "<default>"
            },
            …
        }
    }
    

    After the app is created, it uses a default banner application. Deploy the JAR files again using the Azure CLI. For more information, see the Configure the new Azure Spring Apps service instance section of this article.

  6. If service binding was used and you want to import it to the new service instance, add the key property for the target bound resource. In the following example, a bound MySQL database is included:

    {
        "type": "Microsoft.AppPlatform/Spring/apps/bindings",
        "apiVersion": "{api-version}",
        "name": "[concat(parameters('Spring_new_service_name'), '/api-gateway/mysql')]",
        …
        "_comment": "the following line imports a mysql binding",
        "properties": {
            "resourceId": "[parameters('servers_test_mysql_name_externalid')]",
            "key": "{mysql-password}",
            "bindingParameters": {
                "databaseName": "mysql",
                "username": "{mysql-user-name}"
            }
        }
    }
    

Deploy the template

After you modify the template, use the following steps to deploy the template and create the new resource.

  1. Sign in to the Azure portal.

  2. In the top search box, search for Deploy a custom template.

  3. Under Services, select Deploy a custom template.

  4. Go to the Select a template tab, and then select Build your own template in the editor.

  5. In the template editor, paste in the template.json file you modified earlier, and then select Save.

  6. In the Basics tab, fill in the following information:

    • The target subscription.
    • The target resource group.
    • The target region.
    • Any other parameters required for the template.

    Screenshot of Azure portal showing the Custom deployment pane.

  7. Select Review + create to create the target service instance.

  8. Wait until the template has deployed successfully. If the deployment fails, select Deployment details to view the reason it failed, and then update the template or configurations accordingly.

Configure the new Azure Spring Apps service instance

Some features aren't exported to the template, or can't be imported with a template. You must manually set up some Azure Spring Apps items on the new instance after the template deployment completes successfully. The following guidelines describe these requirements:

Next steps