|
| 1 | +--- |
| 2 | +title: Relocate Azure Static Web Apps to another region |
| 3 | +description: Learn how to relocate Azure Static Web Apps to another region |
| 4 | +author: anaharris-ms |
| 5 | +ms.author: anaharris |
| 6 | +ms.reviewer: anaharris |
| 7 | +ms.date: 08/19/2024 |
| 8 | +ms.service: azure-static-web-apps |
| 9 | +ms.topic: how-to |
| 10 | +ms.custom: |
| 11 | + - subject-relocation |
| 12 | +#Customer intent: As an Azure service administrator, I want to move my Azure Static Web Apps resources to another Azure region. |
| 13 | +--- |
| 14 | + |
| 15 | +# Relocate Azure Static Web Apps to another region |
| 16 | + |
| 17 | +This article describes how to relocate [Azure Static Web Apps](../static-web-apps/overview.md) resources to another Azure region. |
| 18 | + |
| 19 | +[!INCLUDE [relocate-reasons](./includes/service-relocation-reason-include.md)] |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +Review the following prerequisites before you prepare for the relocation. |
| 26 | + |
| 27 | +- [Validate that Azure Static Web Apps is available in the target region](https://azure.microsoft.com/explore/global-infrastructure/products-by-region/). |
| 28 | + |
| 29 | +- Make sure that you have permission to create Static Web App resources in the target region. |
| 30 | + |
| 31 | +- Find out if there any Azure Policy region restrictions applied to your organization. |
| 32 | + |
| 33 | +- If using integrated API support provided by Azure Functions: |
| 34 | + - Determine the availability of Azure Functions in the target region. |
| 35 | + - Determine if Function API Keys are being used. For example, are you using Key Vault or do you deploy them as part of your application configuration files? |
| 36 | + - Determine the deployment model for API support in the target region: [Distributed managed functions](../static-web-apps/distributed-functions.md) or [Bring Your own functions](../static-web-apps/functions-bring-your-own.md). Understand the differences between the two models. |
| 37 | + |
| 38 | +- Ensure that the Standard Hosting Plan is used to host the Static Web App. For more information about hosting plans, see [Azure Static Web Apps hosting plans](../static-web-apps/plans.md). |
| 39 | + |
| 40 | +- Determine the permissible downtime for relocation. |
| 41 | + |
| 42 | +- Depending on your Azure Static Web App deployment, the following dependent resources may need to be deployed and configured in the target region *prior* to relocation: |
| 43 | + |
| 44 | + - [Azure Functions](./relocation-functions.md). |
| 45 | + - [Azure Virtual Network](./relocation-virtual-network.md) |
| 46 | + - [Azure Front Door](../frontdoor/front-door-overview.md) |
| 47 | + - [Network Security Group](./relocation-virtual-network-nsg.md) |
| 48 | + - [Azure Private Link Service](./relocation-private-link.md) |
| 49 | + - [Azure Key Vault](./relocation-key-vault.md) |
| 50 | + - [Azure Storage Account](./relocation-storage-account.md) |
| 51 | + - [Azure Application Gateway](./relocation-app-gateway.md) |
| 52 | + |
| 53 | + |
| 54 | +## Downtime |
| 55 | + |
| 56 | +The relocation of an Azure Static Web site introduces downtime to your application. The downtime is affected by which high availability pattern you have implemented for your Azure Static Web site. General patterns are: |
| 57 | +- **Cold standby**: Workload data is backed up regularly based on its requirements. In case of a disaster, the workload is redeployed in a new Azure region and data is restored. |
| 58 | +- **Warm standby**: The workload is deployed in the business continuity and disaster recovery (BCDR) region, and data is replicated asynchronously or synchronously. In the event of a disaster, the deployment in the disaster recovery (DR) region is scaled up and out. |
| 59 | +- **Multi-region**: The workload is [deployed in both regions](/azure/architecture/web-apps/app-service/architectures/multi-region) and data is replicated synchronously. Both regions have a writable copy of the data. The implementation can be active/passive or active/active. |
| 60 | + |
| 61 | +## Prepare |
| 62 | + |
| 63 | +### Deployments with private endpoints |
| 64 | + |
| 65 | +If your Static Web Apps are deployed with private endpoints, make sure to: |
| 66 | + |
| 67 | +- Update host name for connection endpoint. |
| 68 | +- Update host name on DNS private zone or custom DNS server (only applicable to Private Link). |
| 69 | + |
| 70 | +For more information, see [Configure private endpoint in Azure Static Web Apps](../static-web-apps/private-endpoint.md). |
| 71 | + |
| 72 | + |
| 73 | +### All other deployments |
| 74 | + |
| 75 | +For all other deployment types, make sure to: |
| 76 | + |
| 77 | +- If applicable, retrieve the new Function API keys from Azure Functions in the new region. |
| 78 | + |
| 79 | +- If the Azure Function has a dependency on a database, ensure that the `DATABASE_CONNECTION_STRING` is updated. This database may not be in scope of regional migration. |
| 80 | + |
| 81 | +- Update the custom domain to point to the new hostname of the static web app. |
| 82 | + |
| 83 | +- If using Key Vault, provision a new Key Vault in target region. Update the Function API Keys in Key Vault if applicable. Any other sensitive data not to be stored in code or config files should be stored in this Key Vault |
| 84 | + |
| 85 | + |
| 86 | +### Export the template |
| 87 | + |
| 88 | +To export the Resource Manager template that contains settings that describe your static web app: |
| 89 | + |
| 90 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 91 | +1. Go to your static web app. |
| 92 | +1. From the left menu, under *Automation*, select **Export template**. |
| 93 | + |
| 94 | + The template may take a moment to generate. |
| 95 | + |
| 96 | +1. Select **Download**. |
| 97 | + |
| 98 | +1. Locate the downloaded `.zip` file, and open it into a folder of your choice. |
| 99 | + |
| 100 | + This file contains the `.json` files that include the template and scripts to deploy the template. |
| 101 | + |
| 102 | +1. Make the necessary changes to the template, such as updating the location with target region. |
| 103 | + |
| 104 | + |
| 105 | +## Relocate |
| 106 | + |
| 107 | +Use the following steps to relocate your static web app to another region. |
| 108 | + |
| 109 | +1. If you are relocating with Private Endpoint, follow the guidelines in [Relocate Azure Private Link Service to another region](./relocation-private-link.md). |
| 110 | + |
| 111 | +1. If you've provided an existing Azure Functions to your static web app, follow the relocation procedure for [Azure Functions](./relocation-functions.md). |
| 112 | + |
| 113 | +1. Redeploy you static web app using the [template that you exported and configured in the previous section](#export-the-template). |
| 114 | + |
| 115 | + >[!IMPORTANT] |
| 116 | + > If you're not using a custom domain, your application's URL changes in the target region. In this scenario, ensure that users know about the URL change. |
| 117 | +
|
| 118 | +1. If you're using an Integrated API, create a new Integrated API that's supported by Azure Functions. |
| 119 | + |
| 120 | +1. Reconfigure your repository (GitHub or Azure DevOps) to deploy into the newly deployed static web app in the target region. Initiate the deployment of the application using GitHub actions or Azure Pipelines. |
| 121 | + |
| 122 | +1. With a *cold standby* deployment, make sure you inform clients about the new URL. If you're using a custom DNS domain, simply change the DNS entry to point to the target region. With a *warm standby* deployment, a load balancer, such as Front Door or Traffic manager handle migration of the static web app in the source region to the target region. |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
0 commit comments