Move an Azure Event Hubs namespace to another region
This article shows you how to export an Azure Resource Manager template for an existing Event Hubs namespace and then use the template to create a namespace with same configuration settings in another region. However, this process doesn't move events that aren't processed yet. You need to process the events from the original namespace before deleting it.
If you have other resources in the Azure resource group that contains the Event Hubs namespace, you may want to export the template at the resource group level so that all related resources can be moved to the new region in one step. The steps in this article show you how to export a namespace to the template. The steps for exporting a resource group to the template are similar.
Prerequisites
- Ensure that the services and features that your account uses are supported in the target region.
- If you have capture feature enabled for event hubs in the namespace, move Azure Storage or Azure Data Lake Store Gen 2. You can also move the resource group that contains both Storage and Event Hubs namespaces to the other region by following steps similar to the ones described in this article.
- If the Event Hubs namespace is in an Event Hubs cluster, move the dedicated cluster to the target region before you go through steps in this article. You can also use the quickstart template on GitHub to create an Event Hubs cluster. In the template, remove the namespace portion of the JSON to create only the cluster.
Prepare
To get started, export a Resource Manager template. This template contains settings that describe your Event Hubs namespace.
Sign in to the Azure portal.
Select All resources and then select your Event Hubs namespace.
Select > Settings > Export template.
Choose Download in the Export template page.
Locate the .zip file that you downloaded from the portal, and unzip that file to a folder of your choice.
This zip file contains the .json files that include the template and scripts to deploy the template.
Move
Deploy the template to create an Event Hubs namespace in the target region.
- In the Azure portal, select Create a resource.
- In Search the Marketplace, type template deployment, and select Template deployment (deploy using custom templates).
- Select Build your own template in the editor.
- Select Load file, and then follow the instructions to load the template.json file that you downloaded in the last section.
- Update the value of the
location
property to point to the new region. To obtain location codes, see Azure locations. The code for a region is the region name with no spaces, for example,China North
is equal tochinanorth
. - Select Save to save the template.
- On the Custom deployment page, follow these steps:
- Select an Azure subscription.
- Select an existing resource group or create one. If the source namespace was in an Event Hubs cluster, select the resource group that contains cluster in the target region.
- Select the target location or region. If you selected an existing resource group, this setting is read-only.
- In the SETTINGS section, do the following steps:
Enter the new namespace name.
If your source namespace was in an Event Hubs cluster, enter names of resource group and Event Hubs cluster as part of external ID.
/subscriptions/<AZURE SUBSCRIPTION ID>/resourceGroups/<CLUSTER'S RESOURCE GROUP>/providers/Microsoft.EventHub/clusters/<CLUSTER NAME>
If event hub in your namespace uses a Storage account for capturing events, specify the resource group name and the storage account for
StorageAccounts_<original storage account name>_external
field./subscriptions/0000000000-0000-0000-0000-0000000000000/resourceGroups/<STORAGE'S RESOURCE GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE ACCOUNT NAME>
- Select Review + create at the bottom of the page.
- On the Review + create page, review settings, and then select Create.
Discard or clean up
After the deployment, if you want to start over, you can delete the target Event Hubs namespace, and repeat the steps described in the Prepare and Move sections of this article.
To commit the changes and complete the move of an Event Hubs namespace, delete the Event Hubs namespace in the original region. Make sure that you processed all the events in the namespace before deleting the namespace.
To delete an Event Hubs namespace (source or target) by using the Azure portal:
In the search window at the top of Azure portal, type Event Hubs, and select Event Hubs from search results. You see the Event Hubs namespaces in a list.
Select the target namespace to delete, and select Delete from the toolbar.
On the Delete Namespace page, confirm the deletion by typing the namespace name, and then select Delete.
Next steps
In this tutorial, you moved an Azure Event Hubs namespace from one region to another and cleaned up the source resources. To learn more about moving resources between regions and disaster recovery in Azure, refer to: