Skip to content

Commit 0954281

Browse files
author
Ashish Chhabria
committed
adding more details and images
1 parent 0f32c4c commit 0954281

File tree

6 files changed

+31
-92
lines changed

6 files changed

+31
-92
lines changed

articles/service-bus-messaging/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@
205205
href: service-bus-resource-manager-namespace-auth-rule.md
206206
- name: Create a namespace with topic, subscription, and rule
207207
href: service-bus-resource-manager-namespace-topic-with-rule.md
208+
- name: Secure
209+
items:
210+
- name: Configure customer-managed keys for encryption at rest
211+
href: configure-customer-managed-key.md
208212
- name: Troubleshoot
209213
items:
210214
- name: Exceptions

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

Lines changed: 27 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Enabling the BYOK feature is a one time setup process on your namespace.
2222

2323
> [!NOTE]
2424
> The BYOK compatibility is supported by [Azure Service Bus Premium](service-bus-premium-messaging.md) tier. It cannot be enabled for standard tier Service Bus namespaces.
25+
>
26+
>
27+
> If [Virtual network (VNet) service endpoints](service-bus-service-endpoints.md) are configured on Azure Key Vault for your Service Bus namespace, BYOK will not be supported.
2528
2629
You can use Azure Key Vault 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?](../key-vault/key-vault-overview.md)
2730

@@ -48,12 +51,12 @@ After you enable customer-managed keys, you need to associate the customer manag
4851
1. To turn on both soft delete and purge protection when creating a vault, use the [az keyvault create](/cli/azure/keyvault?view=azure-cli-latest#az-keyvault-create) command.
4952

5053
```azurecli-interactive
51-
az keyvault create --name ContosoVault --resource-group ContosoRG --location westus --enable-soft-delete true --enable-purge-protection true
54+
az keyvault create --name contoso-SB-BYOK-keyvault --resource-group ContosoRG --location westus --enable-soft-delete true --enable-purge-protection true
5255
```
5356
1. To add purge protection to an existing vault (that already has soft delete enabled), use the [az keyvault update](/cli/azure/keyvault?view=azure-cli-latest#az-keyvault-update) command.
5457
5558
```azurecli-interactive
56-
az keyvault update --name ContosoVault --resource-group ContosoRG --enable-purge-protection true
59+
az keyvault update --name contoso-SB-BYOK-keyvault --resource-group ContosoRG --enable-purge-protection true
5760
```
5861
1. Create keys by following these steps:
5962
1. To create a new key, select **Generate/Import** from the **Keys** menu under **Settings**.
@@ -67,11 +70,30 @@ After you enable customer-managed keys, you need to associate the customer manag
6770
1. You can now select this key to associate with the Service Bus namespace for encrypting from the drop-down list.
6871
6972
![Select key from key vault](./media/configure-customer-managed-key/select-key-from-key-vault.png)
70-
73+
> [!NOTE]
74+
> 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.
75+
7176
1. Fill in the details for the key and click **Select**. This will enable the encryption of data at rest on the namespace with a customer managed key.
7277
73-
> [!NOTE]
74-
> For preview, you can only select a single key.
78+
79+
> [!IMPORTANT]
80+
> If you are looking to use Customer managed key along with Geo diaster recovery, please review the below -
81+
>
82+
> To enable encryption at rest with customer managed key, an [access policy](../key-vault/key-vault-secure-your-key-vault.md) is setup for the Service Bus' managed identity on the specified Azure KeyVault. This ensures controlled access to the Azure KeyVault from the Azure Service Bus namespace.
83+
>
84+
> Due to this,
85+
>
86+
> * If [Geo disaster recovery](service-bus-geo-dr.md) is already enabled for the Service Bus namespace and you are looking to enable customer managed key, then
87+
> * Break the pairing
88+
> * [Set up the access policy](../key-vault/managed-identity.md) for the managed identity for both the primary and secondary namespaces to the key vault.
89+
> * Setup encryption on the primary namespace.
90+
> * Re-pair the primary and secondary namespaces.
91+
>
92+
> * If you are looking to enable Geo-DR on a Service Bus namespace where customer managed key is already setup, then -
93+
> * [Set up the access policy](../key-vault/managed-identity.md) for the managed identity for the secondary namespace to the key vault.
94+
> * Pair the primary and secondary namespaces.
95+
>
96+
7597
7698
## Rotate your encryption keys
7799
@@ -86,93 +108,6 @@ Once the encryption key is revoked, the Service Bus service on the encrypted nam
86108
> [!NOTE]
87109
> If you delete an existing encryption key from your key vault and replace it with a new key on the Service Bus namespace, since the delete key is still valid (as it is cached) for up to an hour, your old data (which was encrypted with the old key) may still be accessible along with the new data, which is now accessible only using the new key. This behavior is by design in the preview version of the feature.
88110
89-
## Set up diagnostic logs
90-
Setting diagnostic logs for BYOK enabled namespaces gives you the required information about the operations when a namespace is encrypted with customer-managed keys. These logs can be enabled and later stream to an event hub or analyzed through log analytics or streamed to storage to perform customized analytics. To learn more about diagnostic logs, see [Overview of Azure Diagnostic logs](../azure-monitor/platform/resource-logs-overview.md).
91-
92-
## Enable user logs
93-
Follow these steps to enable logs for customer-managed keys.
94-
95-
1. In the Azure portal, navigate to the namespace that has BYOK enabled.
96-
2. Select **Diagnostic settings** under **Monitoring**.
97-
98-
![Select diagnostic settings](./media/configure-customer-managed-key/select-diagnostic-settings.png)
99-
3. Select **+Add diagnostic setting**.
100-
101-
![Select add diagnostic setting](./media/configure-customer-managed-key/select-add-diagnostic-setting.png)
102-
4. Provide a **name** and select where you want to stream the logs to.
103-
104-
5. Select **CustomerManagedKeyUserLogs** and **Save**. This action enables the logs for BYOK on the namespace.
105-
106-
![Select customer-managed key user logs option](./media/configure-customer-managed-key/select-customer-managed-key-user-logs.png)
107-
108-
## Log schema
109-
All logs are stored in JavaScript Object Notation (JSON) format. Each entry has string fields that use the format described in the following table.
110-
111-
| Name | Description |
112-
| ---- | ----------- |
113-
| TaskName | Description of the task that failed. |
114-
| ActivityId | Internal ID that's used for tracking. |
115-
| category | Defines the classification of the task. For example, if the key from your key vault is being disabled, then it would be an information category or if a key can't be unwrapped, it could fall under error. |
116-
| resourceId | Azure Resource Manager resource ID |
117-
| keyVault | Full name of key vault. |
118-
| key | The key name that's used to encrypt the Service Bus namespace. |
119-
| version | The version of the key being used. |
120-
| operation | The operation that's performed on the key in your key vault. For example, disable/enable the key, wrap, or unwrap |
121-
| code | The code that's associated with the operation. Example: Error code, 404 means that key wasn't found. |
122-
| message | Any error message associated with the operation |
123-
124-
Here's an example of the log for a customer managed key:
125-
126-
```json
127-
{
128-
"TaskName": "CustomerManagedKeyUserLog",
129-
"ActivityId": "11111111-1111-1111-1111-111111111111",
130-
"category": "error"
131-
"resourceId": "/SUBSCRIPTIONS/11111111-1111-1111-1111-11111111111/RESOURCEGROUPS/DEFAULT-EVENTHUB-CENTRALUS/PROVIDERS/MICROSOFT.EVENTHUB/NAMESPACES/FBETTATI-OPERA-EVENTHUB",
132-
"keyVault": "https://mykeyvault.vault-int.azure-int.net",
133-
"key": "mykey",
134-
"version": "1111111111111111111111111111111",
135-
"operation": "wrapKey",
136-
"code": "404",
137-
"message": "Key not found: ehbyok0/111111111111111111111111111111",
138-
}
139-
140-
141-
142-
{
143-
"TaskName": "CustomerManagedKeyUserLog",
144-
"ActivityId": "11111111111111-1111-1111-1111111111111",
145-
"category": "info"
146-
"resourceId": "/SUBSCRIPTIONS/111111111-1111-1111-1111-11111111111/RESOURCEGROUPS/DEFAULT-EVENTHUB-CENTRALUS/PROVIDERS/MICROSOFT.EVENTHUB/NAMESPACES/FBETTATI-OPERA-EVENTHUB",
147-
"keyVault": "https://mykeyvault.vault-int.azure-int.net",
148-
"key": "mykey",
149-
"version": "111111111111111111111111111111",
150-
"operation": "disable" | "restore",
151-
"code": "",
152-
"message": "",
153-
}
154-
```
155-
156-
## Troubleshoot
157-
As a best practice, always enable logs like shown in the previous section. It helps in tracking the activities when BYOK encryption is enabled. It also helps in scoping down the problems.
158-
159-
Following are the common errors codes to look for when BYOK encryption is enabled.
160-
161-
| Action | Error code | Resulting state of data |
162-
| ------ | ---------- | ----------------------- |
163-
| Remove wrap/unwrap permission from a key vault | 403 | Inaccessible |
164-
| Remove AAD role membership from an AAD principal that granted the wrap/unwrap permission | 403 | Inaccessible |
165-
| Delete an encryption key from the key vault | 404 | Inaccessible |
166-
| Delete the key vault | 404 | Inaccessible (assumes soft-delete is enabled, which is a required setting.) |
167-
| Changing the expiration period on the encryption key such that it's already expired | 403 | Inaccessible |
168-
| Changing the NBF (not before) such that key encryption key isn't active | 403 | Inaccessible |
169-
| Selecting the **Allow MSFT Services** option for the key vault firewall or otherwise blocking network access to the key vault that has the encryption key | 403 | Inaccessible |
170-
| Moving the key vault to a different tenant | 404 | Inaccessible |
171-
| Intermittent network issue or DNS/AAD/MSI outage | | Accessible using cached data encryption key |
172-
173-
> [!NOTE]
174-
> If virtual network (VNet) service endpoints are configured on Azure Key Vault for your Service Bus namespace, BYOK will not be supported.
175-
176111
## Next steps
177112
See the following articles:
178113
- [Service Bus overview](service-bus-messaging-overview.md)
23.1 KB
Loading
54.3 KB
Loading
32.7 KB
Loading
15.4 KB
Loading

0 commit comments

Comments
 (0)