Skip to content

Commit 0b5ce4e

Browse files
authored
Merge pull request #281393 from ivywei0125/yuwe/update-key-rotation-doc
[App Configuration] update the doc about how to manage access keys
2 parents ba26c9f + ed25069 commit 0b5ce4e

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

articles/azure-app-configuration/howto-disable-access-key-authentication.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@ ms.date: 04/05/2024
1111

1212
# Manage access key authentication for an Azure App Configuration instance
1313

14-
Every request to an Azure App Configuration resource must be authenticated. By default, requests can be authenticated with either Microsoft Entra credentials, or by using an access key. Of these two types of authentication schemes, Microsoft Entra ID provides superior security and ease of use over access keys, and is recommended by Microsoft. To require clients to use Microsoft Entra ID to authenticate requests, you can disable the usage of access keys for an Azure App Configuration resource. If you want to use access keys to authenticate the request, it's recommended to rotate access keys every 90 days to enhance security.
14+
Every request to an Azure App Configuration resource must be authenticated. By default, requests can be authenticated with either Microsoft Entra credentials, or by using an access key. Of these two types of authentication schemes, Microsoft Entra ID provides superior security and ease of use over access keys, and is recommended by Microsoft. To require clients to use Microsoft Entra ID to authenticate requests, you can disable the usage of access keys for an Azure App Configuration resource. If you want to use access keys to authenticate the request, it's recommended to rotate access keys periodically to enhance security. See [recommendations for protecting application secrets](/azure/well-architected/security/application-secrets) to learn more.
1515

1616
## Enable access key authentication
1717

1818
Access key is enabled by default, you can use access keys in your code to authenticate requests.
1919

20-
> [!WARNING]
21-
> If any clients are currently accessing data in your Azure App Configuration resource with access keys, then Microsoft recommends that you migrate those clients to [Microsoft Entra ID](./concept-enable-rbac.md) before disabling access key authentication.
22-
2320
# [Azure portal](#tab/portal)
2421

25-
To allow/disallow access key authentication for an Azure App Configuration resource in the Azure portal, follow these steps:
22+
To allow access key authentication for an Azure App Configuration resource in the Azure portal, follow these steps:
2623

2724
1. Navigate to your Azure App Configuration resource in the Azure portal.
2825
1. Locate the **Access settings** setting under **Settings**.
@@ -35,7 +32,7 @@ To allow/disallow access key authentication for an Azure App Configuration resou
3532

3633
# [Azure CLI](#tab/azure-cli)
3734

38-
To enable access keys for Azure App configuration resource, use the following command. The `--disable-local-auth` option is set to "false" for enable local auth.
35+
To enable access keys for Azure App configuration resource, use the following command. The `--disable-local-auth` option is set to `false` to enable access key-based authentication.
3936

4037
```azurecli-interactive
4138
az appconfig update \
@@ -48,7 +45,7 @@ az appconfig update \
4845

4946
### Verify that access key authentication is enabled
5047

51-
To verify if access key authentication is enabled, check if you're able to get a list of read and read-write access keys. This list will only exist if access key authentication is enabled.
48+
To verify if access key authentication is enabled, check if you're able to get a list of read-only and read-write access keys. This list will only exist if access key authentication is enabled.
5249

5350
# [Azure portal](#tab/portal)
5451

@@ -66,7 +63,7 @@ To check if access key authentication is enabled for an Azure App Configuration
6663
# [Azure CLI](#tab/azure-cli)
6764

6865
To check if access key authentication is enabled for an Azure App Configuration resource, use the following command. The command will list the access keys for an Azure App Configuration resource.
69-
If access key authentication is enabled, then read access keys and read-write access keys will be returned.
66+
If access key authentication is enabled, then read-only access keys and read-write access keys will be returned.
7067

7168
```azurecli-interactive
7269
az appconfig credential list \
@@ -80,6 +77,9 @@ az appconfig credential list \
8077

8178
Disabling access key authentication will delete all access keys. If any running applications are using access keys for authentication, they will begin to fail once access key authentication is disabled. Only requests that are authenticated using Microsoft Entra ID will succeed. For more information about using Microsoft Entra ID, see [Authorize access to Azure App Configuration using Microsoft Entra ID](./concept-enable-rbac.md). Enabling access key authentication again will generate a new set of access keys and any applications attempting to use the old access keys will still fail.
8279

80+
> [!WARNING]
81+
> If any clients are currently accessing data in your Azure App Configuration resource with access keys, then Microsoft recommends that you migrate those clients to [Microsoft Entra ID](./concept-enable-rbac.md) before disabling access key authentication.
82+
8383
# [Azure portal](#tab/portal)
8484

8585
To disallow access key authentication for an Azure App Configuration resource in the Azure portal, follow these steps:
@@ -95,7 +95,7 @@ To disallow access key authentication for an Azure App Configuration resource in
9595

9696
# [Azure CLI](#tab/azure-cli)
9797

98-
To disable access keys for Azure App configuration resource, use the following command. The `--disable-local-auth` option is set to "true" for disable local auth.
98+
To disable access keys for Azure App configuration resource, use the following command. The `--disable-local-auth` option is set to `true` to disable access key-based authentication.
9999

100100
```azurecli-interactive
101101
az appconfig update \
@@ -154,24 +154,39 @@ Be careful to restrict assignment of these roles only to those users who require
154154
> [!NOTE]
155155
> When access key authentication is disabled and [ARM authentication mode](./quickstart-deployment-overview.md#azure-resource-manager-authentication-mode) of App Configuration store is local, the capability to read/write key-values in an [ARM template](./quickstart-resource-manager.md) will be disabled as well. This is because access to the Microsoft.AppConfiguration/configurationStores/keyValues resource used in ARM templates requires access key authentication with local ARM authentication mode. It's recommended to use pass-through ARM authentication mode. For more information, see [Deployment overview](./quickstart-deployment-overview.md).
156156
157-
## Rotate access key
158-
Microsoft recommends that you rotate your access keys periodically to help keep your resource secure. If possible, use Azure Key Vault to manage your access keys. If you are not using Key Vault, you will need to rotate your keys manually.
159-
160-
Each Azure App Configuration resource has two access keys to enable secret rotation. This is a security precaution that lets you regularly change the keys that can access your service, protecting the privacy of your resource if a key gets leaked. The recommended rotation cycle is 90 days.
157+
## Access key rotation
158+
Microsoft recommends periodic rotation of access keys to mitigate the risk of attack vectors from leaked secrets. Each Azure App Configuration resource includes two read-only access keys and two read-write access keys, designated as primary and secondary keys, to facilitate seamless secret rotation. This setup enables you to alternate access keys in your applications without causing any downtime.
161159

162160
You can rotate keys using the following procedure:
163161

164162
1. If you're using both keys in production, change your code so that only one access key is in use. In this example, let's say you decide to keep using your store's primary key.
165163
You must have only one key in your code, because when you regenerate your secondary key, the older version of that key will stop working immediately, causing clients using the older key to get 401 access denied errors.
166164

167-
1. Once the primary key is the only key in use, you can regenerate the secondary key. Go to your resource's page on the Azure portal, open the **Settings** > **Access settings** menu, and select **Regenerate** under **Secondary key**.
165+
1. Once the primary key is the only key in use, you can regenerate the secondary key.
168166

169-
1. Next, update your code to use the newly generated secondary key.
170-
It helps to have logs or availability to check that users of the key have successfully swapped from using the primary key to the secondary key before you proceed.
167+
### [Azure portal](#tab/portal)
171168

172-
1. Now you can regenerate the primary key using the same process.
169+
Go to your resource's page on the Azure portal, open the **Settings** > **Access settings** menu, and select **Regenerate** under **Secondary key**.
170+
171+
:::image type="content" border="true" source="./media/regenerate-secondary-key.png" alt-text="Screenshot showing regenerate secondary key.":::
172+
173+
### [Azure CLI](#tab/azure-cli)
174+
175+
To regenerate an access key for an App Configuration store, use the following command.
176+
177+
```azurecli-interactive
178+
az appconfig credential regenerate \
179+
--name <app-configuration-name> \
180+
--resource-group <resource-group> \
181+
--id <key-to-be-regenerated>
182+
```
183+
184+
---
185+
186+
1. Next, update your code to use the newly generated secondary key.
187+
It is advisable to review your application logs to confirm that all instances of your application have transitioned from using the primary key to the secondary key before proceeding to the next step.
173188
174-
1. Finally, update your code to use the new primary key.
189+
1. Finally, you can invalidate the primary keys by regenerating them. Next time, you can alternate access keys between the secondary and primary keys using the same process.
175190
176191
## Next steps
177192
-4.46 KB
Loading
17.6 KB
Loading

0 commit comments

Comments
 (0)