Skip to content

Commit 4258deb

Browse files
Merge pull request #286745 from jaganth/docs-editor/configure-customer-managed-key-1726415325
Update configure-customer-managed-key.md
2 parents 2b2306b + 461244d commit 4258deb

File tree

2 files changed

+66
-51
lines changed

2 files changed

+66
-51
lines changed

articles/service-bus-messaging/configure-customer-managed-key.md

Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ There are some caveats to the customer managed key for service side encryption.
1515
You can use Azure Key Vault (including Azure Key Vault Managed HSM) to manage your keys and audit your key usage. You can either create your own keys and store them in a key vault, or you can use the Azure Key Vault APIs to generate keys. For more information about Azure Key Vault, see [What is Azure Key Vault?](/azure/key-vault/general/overview)
1616

1717
## Enable customer-managed keys (Azure portal)
18+
1819
To enable customer-managed keys in the Azure portal, follow these steps:
1920

2021
1. Navigate to your Service Bus Premium namespace.
21-
2. On the **Settings** page of your Service Bus namespace, select **Encryption**.
22-
3. Select the **Customer-managed key encryption at rest** as shown in the following image.
23-
24-
![Enable customer managed key](./media/configure-customer-managed-key/enable-customer-managed-key.png)
22+
1. On the **Settings** page of your Service Bus namespace, select **Encryption**.
23+
1. Select the **Customer-managed key encryption at rest** as shown in the following image.
2524

25+
![Screenshot showing how to enable a customer managed key.](media/configure-customer-managed-key/enable-customer-managed-key.png)
26+
2627
> [!NOTE]
2728
> Currently you can't configure Azure Key Vault Managed HSM through the portal.
2829
@@ -36,49 +37,52 @@ After you enable customer-managed keys, you need to associate the customer manag
3637
> Using customer-managed keys with Azure Service Bus requires that the key vault have two required properties configured. They are: **Soft Delete** and **Do Not Purge**. The Soft Delete property is enabled by default when you create a new key vault in the Azure portal whereas the Purge Protection is optional so make sure to select it when creating the Key Vault. Also, if you need to enable these properties on an existing key vault, you must use either PowerShell or Azure CLI.
3738
3839
# [Key Vault](#tab/Key-Vault)
39-
40+
4041
2. To turn on both soft delete and purge protection when creating a vault, use the [az keyvault create](/cli/azure/keyvault#az-keyvault-create) command.
41-
42-
```azurecli-interactive
43-
az keyvault create --name contoso-SB-BYOK-keyvault --resource-group ContosoRG --location westus --enable-soft-delete true --enable-purge-protection true
44-
```
42+
43+
```azurecli-interactive
44+
az keyvault create --name contoso-SB-BYOK-keyvault --resource-group ContosoRG --location westus --enable-soft-delete true --enable-purge-protection true
45+
```
46+
4547
3. To add purge protection to an existing vault (that already has soft delete enabled), use the [az keyvault update](/cli/azure/keyvault#az-keyvault-update) command.
46-
47-
```azurecli-interactive
48-
az keyvault update --name contoso-SB-BYOK-keyvault --resource-group ContosoRG --enable-purge-protection true
49-
```
50-
48+
49+
```azurecli-interactive
50+
az keyvault update --name contoso-SB-BYOK-keyvault --resource-group ContosoRG --enable-purge-protection true
51+
```
52+
5153
# [Key Vault Managed HSM](#tab/Key-Vault-Managed-HSM)
52-
54+
5355
2. To turn on both soft delete and purge protection when creating a vault, use the [az keyvault create](/cli/azure/keyvault#az-keyvault-create) command.
56+
57+
```azurecli-interactive
58+
az keyvault create --hsm-name contoso-SB-BYOK-keyvault --resource-group ContosoRG --location westus --enable-soft-delete true --enable-purge-protection true
59+
```
5460

55-
```azurecli-interactive
56-
az keyvault create --hsm-name contoso-SB-BYOK-keyvault --resource-group ContosoRG --location westus --enable-soft-delete true --enable-purge-protection true
57-
```
5861
3. To add purge protection to an existing vault (that already has soft delete enabled), use the [az keyvault update](/cli/azure/keyvault#az-keyvault-update) command.
59-
60-
```azurecli-interactive
61-
az keyvault update --hsm-name contoso-SB-BYOK-keyvault --resource-group ContosoRG --enable-purge-protection true
62-
```
63-
---
64-
65-
4. Create keys by following these steps:
66-
1. To create a new key, select **Generate/Import** from the **Keys** menu under **Settings**.
6762

68-
![Select Generate/Import button](./media/configure-customer-managed-key/select-generate-import.png)
69-
70-
1. Set **Options** to **Generate** and give the key a name.
71-
72-
![Create a key](./media/configure-customer-managed-key/create-key.png)
63+
```azurecli-interactive
64+
az keyvault update --hsm-name contoso-SB-BYOK-keyvault --resource-group ContosoRG --enable-purge-protection true
65+
```
66+
---
7367

74-
1. You can now select this key to associate with the Service Bus namespace for encrypting from the drop-down list.
68+
Create keys by following these steps:
7569

76-
![Select key from key vault](./media/configure-customer-managed-key/select-key-from-key-vault.png)
77-
> [!NOTE]
78-
> For redundancy, you can add up to 3 keys. In the event that one of the keys has expired, or is not accessible, the other keys will be used for encryption.
70+
1. To create a new key, select **Generate/Import** from the **Keys** menu under **Settings**.
71+
72+
![Screenshot showing the Generate/Import button.](./media/configure-customer-managed-key/select-generate-import.png)
73+
74+
1. Set **Options** to **Generate** and give the key a name.
75+
76+
![Screenshot that shows how to name a key.](./media/configure-customer-managed-key/create-key.png)
77+
78+
1. You can now select this key to associate with the Service Bus namespace for encrypting from the drop-down list.
79+
80+
![Screenshot that shows how to select a key from key vault.](./media/configure-customer-managed-key/select-key-from-key-vault.png)
81+
82+
> [!NOTE]
83+
> For redundancy, you can add up to 3 keys. In the event that one of the keys has expired, or is not accessible, the other keys will be used for encryption.
7984
80-
1. Fill in the details for the key and click **Select**. This enables the encryption of the Microsoft-managed key with your key (customer-managed key).
81-
85+
1. Fill in the details for the key and click **Select**. This enables the encryption of the Microsoft-managed key with your key (customer-managed key).
8286

8387
> [!IMPORTANT]
8488
> If you are looking to use Customer managed key along with [Geo-Disaster Recovery](service-bus-geo-dr.md), please review this section.
@@ -105,16 +109,18 @@ There are two types of managed identities that you can assign to a Service Bus n
105109
- **System-assigned**: You can enable a managed identity directly on a Service Bus namespace. When you enable a system-assigned managed identity, an identity is created in Microsoft Entra that's tied to the lifecycle of that Service Bus namespace. So when the namespace is deleted, Azure automatically deletes the identity for you. By design, only that Azure resource (namespace) can use this identity to request tokens from Microsoft Entra ID.
106110
- **User-assigned**: You may also create a managed identity as a standalone Azure resource, which is called user-assigned identity. You can create a user-assigned managed identity and assign it to one or more Service Bus namespaces. When you use user-assigned managed identities, the identity is managed separately from the resources that use it. They aren't tied to the lifecycle of the namespace. You can explicitly delete a user-assigned identity when you no longer need it.
107111

108-
For more information, see [What are managed identities for Azure resources?](../active-directory/managed-identities-azure-resources/overview.md).
112+
For more information, see [What are managed identities for Azure resources?](../active-directory/managed-identities-azure-resources/overview.md).
109113

110114
## Encrypt using system-assigned identities (template)
111-
This section shows how to do the following tasks:
112115

113-
1. Create a **premium** Service Bus namespace with a **managed service identity**.
114-
2. Create a **key vault** and grant the service identity access to the key vault.
115-
3. Update the Service Bus namespace with the key vault information (key/value).
116+
This section shows you how to do the following tasks:
117+
118+
- Create a **premium** Service Bus namespace with a **managed service identity**.
119+
- Create a **key vault** and grant the service identity access to the key vault.
120+
- Update the Service Bus namespace with the key vault information (key/value).
116121

117122
### Create a premium Service Bus namespace with managed service identity
123+
118124
This section shows you how to create an Azure Service Bus namespace with managed service identity by using an Azure Resource Manager template and PowerShell.
119125

120126
1. Create an Azure Resource Manager template to create a Service Bus premium tier namespace with a managed service identity. Name the file: **CreateServiceBusPremiumNamespace.json**:
@@ -205,6 +211,7 @@ Set-AzureRmKeyVaultAccessPolicy -VaultName {keyVaultName} -ResourceGroupName {RG
205211
```
206212

207213
### Encrypt data in Service Bus namespace with customer-managed key from key vault
214+
208215
You have done the following steps so far:
209216

210217
1. Created a premium namespace with a managed identity.
@@ -344,6 +351,7 @@ In this step, you update the Service Bus namespace with key vault information.
344351
1. Create a **premium** Service Bus namespace with the managed user-identity and the key vault information.
345352
346353
### Create a user-assigned identity
354+
347355
Follow instructions from the [Create a user-assigned managed identity](../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-portal.md#create-a-user-assigned-managed-identity) article to create a user-assigned identity. You can also create a user-assigned identity using [CLI](../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-cli.md), [PowerShell](../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-powershell.md), [Azure Resource Manager template](../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-arm.md), and [REST](../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-rest.md).
348356
349357
> [!NOTE]
@@ -550,6 +558,7 @@ This section gives you an example that shows you how to do the following tasks u
550558
```
551559
552560
## Use both user-assigned and system-assigned identities
561+
553562
A namespace can have both system-assigned and user-assigned identities at the same time. In this case, the `type` property would be `SystemAssigned`, `UserAssigned` as shown in the following example.
554563
555564
```json
@@ -599,6 +608,7 @@ See the following example for using the user-managed identity for the encryption
599608
```
600609

601610
## Enable infrastructure (double) encryption of data
611+
602612
If you require a higher level of assurance that your data is secure, you can enable infrastructure level encryption, which is also known as Double Encryption.
603613

604614
When infrastructure encryption is enabled, data in the Azure Service Bus is encrypted twice, once at the service level and once at the infrastructure level, using two different encryption algorithms and two different keys. Hence, infrastructure encryption of Azure Service Bus data protects against a scenario where one of the encryption algorithms or keys may be compromised.
@@ -644,10 +654,9 @@ Here are more details:
644654

645655
## Considerations when using Geo-Disaster Recovery
646656

647-
### Geo-Disaster Recovery - encryption with system-assigned identities
657+
### Encryption with system-assigned identities
648658
To enable encryption of Microsoft-managed key with a customer managed key, an [access policy](/azure/key-vault/general/secure-your-key-vault) is set up for a system-assigned managed identity on the specified Azure KeyVault. This step ensures controlled access to the Azure KeyVault from the Azure Service Bus namespace. Therefore, you need to follow these steps:
649659

650-
651660
- If [Geo-Disaster Recovery](service-bus-geo-dr.md) is already enabled for the Service Bus namespace and you're looking to enable customer managed key, then
652661
- Break the pairing.
653662
- [Set up the access policy](/azure/key-vault/general/assign-access-policy-portal) for the system-assigned managed identity for both the primary and secondary namespaces to the key vault.
@@ -657,30 +666,36 @@ To enable encryption of Microsoft-managed key with a customer managed key, an [a
657666
- [Set up the access policy](/azure/key-vault/general/assign-access-policy-portal) for the managed identity for the secondary namespace to the key vault.
658667
- Pair the primary and secondary namespaces.
659668

660-
### Geo-Disaster Recovery - encryption with user-assigned identities
669+
### Encryption with user-assigned identities
670+
661671
Here are a few recommendations:
662672

663-
1. Create managed identity and assign Key Vault permissions to your managed identity.
664-
2. Add the identity as a user assigned identity, and enable encryption with the identity on both namespaces.
665-
3. Pair namespaces together
673+
- Create managed identity and assign Key Vault permissions to your managed identity.
674+
- Add the identity as a user assigned identity, and enable encryption with the identity on both namespaces.
675+
- Pair namespaces together.
666676

667677
Conditions for enabling Geo-Disaster Recovery and Encryption with User-Assigned Identities:
668678

669-
1. Secondary namespace must already have Encryption enabled with a User-Assigned identity if it's to be paired with a primary namespace that has Encryption enabled.
670-
2. It isn't possible to enable Encryption on an already paired primary, even if the secondary has a User-Assigned identity associated with the namespace.
679+
- Secondary namespace must already have Encryption enabled with a User-Assigned identity if it's to be paired with a primary namespace that has Encryption enabled.
680+
- It isn't possible to enable Encryption on an already paired primary, even if the secondary has a User-Assigned identity associated with the namespace.
671681

672682
## Troubleshoot
673683

674684
### Symptom
685+
675686
You get an error stating that the Service Bus namespace is disabled because the encryption key is no longer valid.
676687

677688
### Cause
689+
678690
You may be using the `resource_id` or `version`, which links to a specific version of the key, which may have expired. If a specific version is provided, Service Bus uses that version of the key, even if the key is rotated.
679691

680692
### Resolution
693+
681694
Use the [`resource__versionless_id` or `versionless_id`](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_key#attributes-reference) instead of using `resource_id` or `version`.
682695

683696
## Next steps
697+
684698
See the following articles:
699+
685700
- [Service Bus overview](service-bus-messaging-overview.md)
686-
- [Key Vault overview](/azure/key-vault/general/overview)
701+
- [Key Vault overview](/azure/key-vault/general/overview)
41.2 KB
Loading

0 commit comments

Comments
 (0)