Skip to content

Commit db468a2

Browse files
authored
Update backup-restore.md
trusted service bypass in public preview
1 parent 2aadd68 commit db468a2

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

articles/key-vault/managed-hsm/backup-restore.md

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,38 @@ You must provide following information to execute a full backup:
2929
- HSM name or URL
3030
- Storage account name
3131
- Storage account blob storage container
32-
- Storage container SAS token with permissions `crdw`
32+
- Storage container SAS token with permissions `crdw` (if storage account is not behind a private endpoint)
3333

3434
[!INCLUDE [cloud-shell-try-it.md](../../../includes/cloud-shell-try-it.md)]
3535

36+
### Prerequisites if the storage account is behind a private endpoint (preview):
37+
38+
1. Ensure you have the latest CLI version installed.
39+
2. Create a user assigned managed identity.
40+
3. Create a storage account (or use an existing storage account).
41+
4. Enable Trusted service bypass on the storage account in the “Networking” tab, under “Exceptions.”
42+
43+
6. Provide ‘storage blob data contributor’ role access to the user assigned managed identity created in step#2. Do this by going to the “Access Control” tab on the portal -> Add Role Assignment. Then select “managed identity” and select the managed identity created in step#2 -> Review + Assign
44+
7. Create the Managed HSM and associate the managed identity with below command.
45+
```azurecli-interactive
46+
az keyvault create --hsm-name mhsmdemo2 –g mhsmrgname –l mhsmlocation -- retention-days 7 --administrators "initialadmin" --mi-user-assigned "/subscriptions/subid/resourcegroups/mhsmrgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/userassignedidentitynamefromstep2"
47+
```
48+
8. If you have an existing Managed HSM, associate the managed identity by updating the MHSM with the below command.
49+
```azurecli-interactive
50+
az keyvault update-hsm --hsm-name mhsmdemo2 –g mhsmrgname --mi-user-assigned "/subscriptions/subid/resourcegroups/mhsmrgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/userassignedidentitynamefromstep2"
51+
```
52+
3653
## Full backup
3754

3855
Backup is a long running operation but will immediately return a Job ID. You can check the status of backup process using this Job ID. The backup process creates a folder inside the designated container with a following naming pattern **`mhsm-{HSM_NAME}-{YYYY}{MM}{DD}{HH}{mm}{SS}`**, where HSM_NAME is the name of managed HSM being backed up and YYYY, MM, DD, HH, MM, mm, SS are the year, month, date, hour, minutes, and seconds of date/time in UTC when the backup command was received.
3956

4057
While the backup is in progress, the HSM might not operate at full throughput as some HSM partitions will be busy performing the backup operation.
4158

42-
> [!IMPORTANT]
43-
> Public internet access must **not** be blocked from the storage accounts being used to backup or restore resources.
44-
59+
### Backup HSM when storage account is behind a private endpoint (preview)
60+
```azurecli-interactive
61+
az keyvault backup start --use-managed-identity true --hsm-name mhsmdemo2 -- storage-account-name mhsmdemobackup --blob-container-name mhsmdemobackupcontainer
62+
```
63+
### Backup HSM when storage account is not behind a private endpoint
4564

4665
```azurecli-interactive
4766
# time for 500 minutes later for SAS token expiry
@@ -63,6 +82,7 @@ sas=$(az storage container generate-sas -n mhsmdemobackupcontainer --account-nam
6382
# Backup HSM
6483
6584
az keyvault backup start --hsm-name mhsmdemo2 --storage-account-name mhsmdemobackup --blob-container-name mhsmdemobackupcontainer --storage-container-SAS-token $sas --subscription 361da5d4-a47a-4c79-afdd-d66f684f4070
85+
6686
```
6787

6888
## Full restore
@@ -78,13 +98,19 @@ You must provide the following information to execute a full restore:
7898
- HSM name or URL
7999
- Storage account name
80100
- Storage account blob container
81-
- Storage container SAS token with permissions `rl`
101+
- Storage container SAS token with permissions `rl` (if storage account is not behind a private endpoint)
82102
- Storage container folder name where the source backup is stored
83103

84104
Restore is a long running operation but will immediately return a Job ID. You can check the status of the restore process using this Job ID. When the restore process is in progress, the HSM enters a restore mode and all data plane command (except check restore status) are disabled.
85105

106+
### Restore HSM when storage account is behind a private endpoint (preview)
107+
```azurecli-interactive
108+
az keyvault restore start --hsm-name mhsmdemo2 --storage-account-name mhsmdemobackup--blob-container-name mhsmdemobackupcontainer --backup-folder mhsm-backup-foldername --use-managed-identity true
109+
```
110+
### Restore HSM when storage account is not behind a private endpoint
111+
86112
```azurecli-interactive
87-
#### time for 500 minutes later for SAS token expiry
113+
# time for 500 minutes later for SAS token expiry
88114
89115
end=$(date -u -d "500 minutes" '+%Y-%m-%dT%H:%MZ')
90116
@@ -95,18 +121,22 @@ skey=$(az storage account keys list --query '[0].value' -o tsv --account-name mh
95121
# Generate a container sas token
96122
97123
sas=$(az storage container generate-sas -n mhsmdemobackupcontainer --account-name mhsmdemobackup --permissions rl --expiry $end --account-key $skey -o tsv --subscription a1ba9aaa-b7f6-4a33-b038-6e64553a6c7b)
98-
```
99124
100-
## Restore HSM
125+
# Restore HSM
101126
102-
```
103127
az keyvault restore start --hsm-name mhsmdemo2 --storage-account-name mhsmdemobackup --blob-container-name mhsmdemobackupcontainer --storage-container-SAS-token $sas --backup-folder mhsm-mhsmdemo-2020083120161860
104128
```
105129

106130
## Selective key restore
107131

108132
Selective key restore allows you to restore one individual key with all its key versions from a previous backup to an HSM.
109133

134+
### Selective key restore when storage account is behind a private endpoint (preview)
135+
```
136+
az keyvault restore start --hsm-name mhsmdemo2 --storage-account-name mhsmdemobackup --blob-container-name mhsmdemobackupcontainer --backup-folder mhsm-backup-foldername --use-managed-identity true --key-name rsa-key2
137+
```
138+
139+
### Selective key restore when storage account is not behind a private endpoint
110140
```
111141
az keyvault restore start --hsm-name mhsmdemo2 --storage-account-name mhsmdemobackup --blob-container-name mhsmdemobackupcontainer --storage-container-SAS-token $sas --backup-folder mhsm-mhsmdemo-2020083120161860 -–key-name rsa-key2
112142
```

0 commit comments

Comments
 (0)