You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/service-bus-messaging/configure-customer-managed-key.md
+27-92Lines changed: 27 additions & 92 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@ Enabling the BYOK feature is a one time setup process on your namespace.
22
22
23
23
> [!NOTE]
24
24
> 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.
25
28
26
29
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)
27
30
@@ -48,12 +51,12 @@ After you enable customer-managed keys, you need to associate the customer manag
48
51
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.
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.
54
57
55
58
```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
57
60
```
58
61
1. Create keys by following these steps:
59
62
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
67
70
1. You can now select this key to associate with the Service Bus namespace for encrypting from the drop-down list.
68
71
69
72

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
+
71
76
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.
72
77
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
+
75
97
76
98
## Rotate your encryption keys
77
99
@@ -86,93 +108,6 @@ Once the encryption key is revoked, the Service Bus service on the encrypted nam
86
108
> [!NOTE]
87
109
> 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.
88
110
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**.
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
-

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:
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
-
176
111
## Next steps
177
112
See the following articles:
178
113
- [Service Bus overview](service-bus-messaging-overview.md)
0 commit comments