|
| 1 | +--- |
| 2 | +title: Enable multi-region replication on Azure Managed HSM (Preview) |
| 3 | +description: Enable Multi-Region Replication on Azure Managed HSM (Preview) |
| 4 | +services: key-vault |
| 5 | +author: msmbaldwin |
| 6 | +ms.service: key-vault |
| 7 | +ms.subservice: managed-hsm |
| 8 | +ms.topic: tutorial |
| 9 | +ms.date: 11/25/2022 |
| 10 | +ms.author: mbaldwin |
| 11 | +ms.custom: references_regions |
| 12 | +--- |
| 13 | +# Enable multi-region replication on Azure Managed HSM (Preview) |
| 14 | + |
| 15 | +Multi-region replication allows you to extend a managed HSM pool from one Azure region (called a primary) to another Azure region (called a secondary). Once configured, both regions are active, able to serve requests, and with automated replication will share the same key material, roles, and permissions. The closest available region to the application will receive and fulfill the request thereby maximizing read throughput and latency. While regional outages are rare, multi-region replication will enhance the availability of mission critical cryptographic keys should one region become unavailable. For more information on SLA, visit [SLA for Azure Key Vault Managed HSM](https://azure.microsoft.com/support/legal/sla/key-vault-managed-hsm/v1_0/). |
| 16 | + |
| 17 | +## Architecture |
| 18 | + |
| 19 | +:::image type="content" source="../media/multi-region-replication.png" alt-text="Architecture diagram of managed HSM Multi-Region Replication." lightbox="../media/multi-region-replication.png"::: |
| 20 | +When multi-region replication is enabled on a managed HSM, a second managed HSM pool, with three load-balanced HSM partitions will be created in the secondary region. When requests are issued to the Traffic Manager global DNS endpoint `<hsm-name>.managedhsm.azure.net`, the closest available region will receive and fulfill the request. While each region individually maintains regional high-availability due to the distribution of HSMs across the region, the traffic manager ensures that even if all partitions of a managed HSM in one region are unavailable due to a catastrophe, requests can still be served by the secondary managed HSM pool. |
| 21 | + |
| 22 | +## Replication latency |
| 23 | + |
| 24 | +Any write operation to the Managed HSM, such as creating or updating a key, creating or updating a role definition, or creating or updating a role assignment, may take up to 6 minutes before both regions are fully replicated. Within this window, it isn't guaranteed that the written material has replicated between the regions. Therefore, it's best to wait six minutes between creating or updating the key and using the key to ensure that the key material has fully replicated between regions. The same applies for role assignments and role definitions. |
| 25 | + |
| 26 | +## Failover behavior |
| 27 | + |
| 28 | +Failover occurs when one of the regions in a multi-region Managed HSM becomes unavailable due to an outage and the other region begins to service all requests. The outage may be limited to your HSM pool only, the entire Managed HSM service, or the entire Azure region. During failover, you may notice a change in behavior depending on the affected region. |
| 29 | + |
| 30 | +| Affected Region | Reads Allowed | Writes Allowed | |
| 31 | +|--|--|--| |
| 32 | +| Secondary | Yes | Yes | |
| 33 | +| Primary | Yes | Maybe | |
| 34 | + |
| 35 | +If the secondary region becomes unavailable, read operations (get key, list keys, all crypto operations, list role assignments) will be available if the primary region is alive. Write operations (create and update keys, create and update role assignments, create and update role definitions) will also be available. |
| 36 | + |
| 37 | +If the primary region is unavailable, read operations will be available, but write operations may not, depending on the scope of the outage. |
| 38 | + |
| 39 | +## Time to failover |
| 40 | + |
| 41 | +Under the hood, DNS resolution handles the redirection of requests to either the primary or secondary region. |
| 42 | + |
| 43 | +If both regions are active, the Traffic Manager will resolve an incoming request to the location that has the closest geographical proximity or lowest network latency to the origin of the request. DNS records are configured with a default TTL of 5 seconds. |
| 44 | + |
| 45 | +If a region reports an unhealthy status to the Traffic Manager, future requests will resolve to the other region if available. Clients caching DNS lookups may experience extended failover time. But once any client-side caches expire, future requests should route to the available region. |
| 46 | + |
| 47 | +## Azure region support |
| 48 | + |
| 49 | +The following regions are supported for the preview. |
| 50 | + |
| 51 | +- UK South |
| 52 | +- US West |
| 53 | +- US Central * |
| 54 | +- US West Central |
| 55 | +- US East |
| 56 | +- US East 2 * |
| 57 | +- Europe North |
| 58 | +- Europe West * |
| 59 | +- Switzerland West |
| 60 | +- Switzerland North |
| 61 | +- Asia SouthEast |
| 62 | +- India Central |
| 63 | +- Australia East |
| 64 | + |
| 65 | +> [!NOTE] |
| 66 | +> US Central, US East 2, and Europe West cannot be extended as a secondary region at this time. |
| 67 | +
|
| 68 | +## Billing |
| 69 | + |
| 70 | +Multi-region replication into secondary region incurs extra billing (x2) as a new HSM pool will be consumed in the secondary region. For more information, see [Azure Managed HSM pricing](https://azure.microsoft.com/pricing/details/key-vault). |
| 71 | + |
| 72 | +## Soft-delete behavior |
| 73 | + |
| 74 | +The [Managed HSM soft-delete feature](soft-delete-overview.md) allows recovery of deleted HSMs and keys however in a multi-region replication enabled scenario, there are subtle differences where the secondary HSM must be deleted before soft-delete can be executed on the primary HSM. Additionally, when a secondary is deleted, it's purged immediately and doesn't go into a soft-delete state that stops all billing for the secondary. You can always extend to a new region as the secondary from the primary if needed. |
| 75 | + |
| 76 | +### Azure CLI commands |
| 77 | + |
| 78 | +If creating a new Managed HSM pool and then extending to a secondary, refer to [these instructions](quick-create-cli.md#create-a-managed-hsm) prior to extending. If extending from an already existing Managed HSM pool, then use the following instructions to create a secondary HSM into another region. |
| 79 | + |
| 80 | +### Install the multi-region managed HSM replication extension |
| 81 | + |
| 82 | +```azurecli-interactive |
| 83 | +az extension add -n keyvault-preview |
| 84 | +``` |
| 85 | + |
| 86 | +### Add a secondary HSM in another region |
| 87 | + |
| 88 | +To extend a managed HSM pool to another region, run the following command that will automatically create a second HSM. |
| 89 | + |
| 90 | +```azurecli-interactive |
| 91 | +az keyvault region add --hsm-name "ContosoMHSM" --region "australiaeast" |
| 92 | +``` |
| 93 | + |
| 94 | +> [!NOTE] |
| 95 | +> "ContosoMHSM" in this example is the primary HSM pool name; "australiaeast" is the secondary region into which you are extending it. |
| 96 | +
|
| 97 | +### Remove a secondary HSM in another region |
| 98 | + |
| 99 | +Once you remove a secondary HSM, the HSM partitions in the other region will be purged. All secondaries must be deleted before a primary managed HSM can be soft-deleted or purged. Only secondaries can be deleted using this command. The primary can only be deleted using the [soft-delete](soft-delete-overview.md#soft-delete-behavior) and [purge](soft-delete-overview.md#purge-protection) commands |
| 100 | + |
| 101 | +```azurecli-interactive |
| 102 | +az keyvault region remove --hsm-name ContosoMHSM --region australiaeast |
| 103 | +``` |
| 104 | + |
| 105 | +### List all regions |
| 106 | + |
| 107 | +```azurecli-interactive |
| 108 | +az keyvault region list --hsm-name ContosoMHSM |
| 109 | +``` |
| 110 | + |
| 111 | +## Next steps |
| 112 | + |
| 113 | +- [Managed HSM role management](role-management.md) |
| 114 | +- [Azure Data Encryption At Rest](../../security/fundamentals/encryption-atrest.md) |
| 115 | +- [Azure Storage Encryption](../../storage/common/storage-service-encryption.md) |
0 commit comments