Skip to content

Commit 7585c38

Browse files
committed
update
1 parent d4860fc commit 7585c38

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

articles/key-vault/managed-hsm/disaster-recovery-guide.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,33 +95,61 @@ az keyvault security-domain upload --hsm-name ContosoMHSM2 --sd-exchange-key Con
9595

9696
Now both the source HSM (ContosoMHSM) and the destination HSM (ContosoMHSM2) have the same security domain. We can now restore a full backup from the source HSM into the destination HSM.
9797

98-
## Create a backup (as a restore point) of your new HSM
98+
## Backup and restore
9999

100-
It's always a good idea to take a full backup before you execute a full HSM restore, so that you have a restore point in case something goes wrong with the restore.
100+
It's always a good idea to take a full backup before you execute a full HSM restore, so that you have a restore point in case something goes wrong with the restore. You can do this using one of two methods: user assigned managed identity, or SAS tokens.
101+
102+
### Create a backup (as a restore point) of your new HSM
101103

102104
To create an HSM backup, you'll need:
103105
- A storage account where the backup will be stored
104106
- A blob storage container in this storage account where the backup process will create a new folder to store encrypted backup
107+
- A user assigned managed identity that has the Storage Blob Data Contributor role on the storage account OR storage container SAS token with permissions 'crdw'
108+
109+
We use az keyvault backup command to the HSM backup in the storage container **mhsmbackupcontainer**, which is in the storage account **mhsmdemobackup** in the following examples.
110+
111+
### [User assigned managed identity](#tab/uami)
105112

106-
We use `az keyvault backup` command to the HSM backup in the storage container **mhsmbackupcontainer**, which is in the storage account **mhsmdemobackup** in the following example. We create a SAS token that expires in 30 minutes and provide that to Managed HSM to write the backup.
113+
If using the user assigned managed identity method, we specify the user assigned managed identity with the `--mi-user-assigned` parameter and associate that to the Managed HSM before writing the backup in the below example.
114+
115+
```azurecli-interactive
116+
az keyvault update-hsm --hsm-name ContosoMHSM2 --mi-user-assigned "/subscriptions/subid/resourcegroups/mhsmrgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/userassignedidentityname"
117+
az keyvault backup start --use-managed-identity true --hsm-name ContosoMHSM2 --storage-account-name mhsmdemobackup --blob-container-name mhsmbackupcontainer
118+
```
119+
120+
### [SAS token](#tab/sas)
121+
122+
If using the SAS token method, we create a SAS token that expires in 30 minutes and provide that to Managed HSM to write the backup in the below example.
107123

108124
```azurecli-interactive
109125
end=$(date -u -d "500 minutes" '+%Y-%m-%dT%H:%MZ')
110126
skey=$(az storage account keys list --query '[0].value' -o tsv --account-name mhsmdemobackup)
111127
az storage container create --account-name mhsmdemobackup --name mhsmbackupcontainer --account-key $skey
112128
sas=$(az storage container generate-sas -n mhsmbackupcontainer --account-name mhsmdemobackup --permissions crdw --expiry $end --account-key $skey -o tsv)
113129
az keyvault backup start --hsm-name ContosoMHSM2 --storage-account-name mhsmdemobackup --blob-container-name mhsmbackupcontainer --storage-container-SAS-token $sas
114-
115130
```
116131

117-
## Restore backup from source HSM
132+
---
118133

119-
For this step you need:
134+
### Restore backup from source HSM
120135

136+
For this step you need:
121137
- The storage account and the blob container in which the source HSM's backups are stored.
122138
- The folder name from where you want to restore the backup. If you create regular backups, there will be many folders inside this container.
123139

124-
We use `az keyvault restore` command to the new HSM **ContosoMHSM2**, using the backup of the source MHSM we are trying to restore, which is in the folder name **mhsm-ContosoMHSM-2020083120161860** found in the storage container **mhsmdemobackupcontainer** of the storage account **ContosoBackup** in the following example. We create a SAS token that expires in 30 minutes and provide that to Managed HSM to write the restore.
140+
We use az keyvault restore command to the new HSM ContosoMHSM2, using the backup of the source MHSM we are trying to restore, which is in the folder name **mhsm-ContosoMHSM-2020083120161860** found in the storage container **mhsmdemobackupcontainer** of the storage account **ContosoBackup** in the following example.
141+
142+
### [User assigned managed identity](#tab/uami)
143+
144+
If using the user assigned managed identity method, we set the `--use-managed-identity` pramater to "true".
145+
146+
```azurecli-interactive
147+
az keyvault restore start --hsm-name ContosoMHSM2 --storage-account-name ContosoBackup --blob-container-name mhsmdemobackupcontainer --backup-folder mhsm-ContosoMHSM-2020083120161860 --use-managed-identity true
148+
```
149+
150+
### [SAS token](#tab/sas)
151+
152+
If using the SAS token method, we create a SAS token that expires in 30 minutes and provide that to Managed HSM to write the restore.
125153

126154
```azurecli-interactive
127155
end=$(date -u -d "500 minutes" '+%Y-%m-%dT%H:%MZ')
@@ -130,8 +158,11 @@ sas=$(az storage container generate-sas -n mhsmdemobackupcontainer --account-nam
130158
az keyvault restore start --hsm-name ContosoMHSM2 --storage-account-name ContosoBackup --blob-container-name mhsmdemobackupcontainer --storage-container-SAS-token $sas --backup-folder mhsm-ContosoMHSM-2020083120161860
131159
```
132160

161+
---
162+
133163
Now you've completed a full disaster recovery process. The contents of the source HSM when the backup was taken are copied to the destination HSM, including all the keys, versions, attributes, tags, and role assignments.
134164

165+
135166
## Next steps
136167

137168
- Learn more about Security Domain see [About Managed HSM Security Domain](security-domain.md)

0 commit comments

Comments
 (0)