Skip to content

Commit bde3098

Browse files
committed
Update quickstart to use Microsoft Entra ID
1 parent 83a7294 commit bde3098

File tree

4 files changed

+128
-58
lines changed

4 files changed

+128
-58
lines changed

articles/azure-app-configuration/TOC.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,21 @@
204204
href: concept-disaster-recovery.md
205205
- name: Security
206206
items:
207-
- name: Encrypt using customer-managed keys
208-
href: concept-customer-managed-keys.md
209-
- name: Secure your config store using Private Endpoints
210-
href: concept-private-endpoint.md
211-
- name: Enable access using Microsoft Entra ID
207+
- name: Authenticate using Microsoft Entra ID
212208
href: concept-enable-rbac.md
213-
- name: Assign an Azure Managed Identity
214-
href: overview-managed-identity.md
215-
- name: Manage access key authentication
209+
- name: Authenticate using access keys
216210
href: howto-disable-access-key-authentication.md
217-
- name: Security controls by Azure Policy
211+
- name: Secure your store using Private Endpoints
212+
href: concept-private-endpoint.md
213+
- name: Disable public network access
214+
href: howto-disable-public-access.md
215+
- name: Encrypt your data using customer-managed keys
216+
href: concept-customer-managed-keys.md
217+
- name: Add a Managed Identity to your store
218+
href: overview-managed-identity.md
219+
- name: Enforce security controls using Azure Policies
218220
href: ./security-controls-policy.md
219-
- name: Security baseline
221+
- name: Understand the security baselines
220222
href: /security/benchmark/azure/baselines/azure-app-configuration-security-baseline?toc=/azure/azure-app-configuration/TOC.json
221223
- name: How-to guides
222224
items:
@@ -240,8 +242,6 @@
240242
href: howto-recover-deleted-stores-in-azure-app-configuration.md
241243
- name: Enable geo-replication
242244
href: howto-geo-replication.md
243-
- name: Disable public access
244-
href: howto-disable-public-access.md
245245
- name: Set up private access
246246
href: howto-set-up-private-access.md
247247
- name: Reference
Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,62 @@
11
---
2-
title: Authorize access to Azure App Configuration using Microsoft Entra ID
2+
title: Access Azure App Configuration using Microsoft Entra ID
33
description: Enable Azure RBAC to authorize access to your Azure App Configuration instance.
4-
author: maud-lv
5-
ms.author: malev
6-
ms.date: 04/05/2024
4+
author: zhenlan
5+
ms.author: zhenlwa
6+
ms.date: 10/05/2024
77
ms.topic: conceptual
88
ms.service: azure-app-configuration
99

1010
---
11-
# Authorize access to Azure App Configuration using Microsoft Entra ID
12-
Besides using Hash-based Message Authentication Code (HMAC), Azure App Configuration supports using Microsoft Entra ID to authorize requests to App Configuration instances. Microsoft Entra ID allows you to use Azure role-based access control (Azure RBAC) to grant permissions to a security principal. A security principal may be a user, a [managed identity](../active-directory/managed-identities-azure-resources/overview.md), or an [application service principal](../active-directory/develop/app-objects-and-service-principals.md). To learn more about roles and role assignments, see [Understanding different roles](../role-based-access-control/overview.md).
11+
# Access Azure App Configuration using Microsoft Entra ID
12+
Azure App Configuration supports authorization of requests to App Configuration stores using Microsoft Entra ID. With Microsoft Entra ID, you can leverage Azure role-based access control ([Azure RBAC](../role-based-access-control/overview.md)) to grant permissions to security principals, which can be user principals, [managed identities](../active-directory/managed-identities-azure-resources/overview.md), or [service principals](../active-directory/develop/app-objects-and-service-principals.md).
1313

1414
## Overview
15-
Requests made by a security principal to access an App Configuration resource must be authorized. With Microsoft Entra ID, access to a resource is a two-step process:
16-
1. The security principal's identity is authenticated and an OAuth 2.0 token is returned. The resource name to request a token is `https://login.microsoftonline.com/{tenantID}` where `{tenantID}` matches the Microsoft Entra tenant ID to which the service principal belongs.
17-
2. The token is passed as part of a request to the App Configuration service to authorize access to the specified resource.
15+
Accessing an App Configuration store using Microsoft Entra ID involves two steps:
1816

19-
The authentication step requires that an application request contains an OAuth 2.0 access token at runtime. If an application is running within an Azure entity, such as an Azure Functions app, an Azure Web App, or an Azure VM, it can use a managed identity to access the resources. To learn how to authenticate requests made by a managed identity to Azure App Configuration, see [Authenticate access to Azure App Configuration resources with Microsoft Entra ID and managed identities for Azure Resources](howto-integrate-azure-managed-service-identity.md).
17+
1. **Authentication**: Acquire a token of the security principal from Microsoft Entra ID for App Configuration. For more details, see [Microsoft Entra authentication](./rest-api-authentication-azure-ad.md) in App Configuration.
2018

21-
The authorization step requires that one or more Azure roles be assigned to the security principal. Azure App Configuration provides Azure roles that encompass sets of permissions for App Configuration resources. The roles that are assigned to a security principal determine the permissions provided to the principal. For more information about Azure roles, see [Azure built-in roles for Azure App Configuration](#azure-built-in-roles-for-azure-app-configuration).
22-
23-
## Assign Azure roles for access rights
24-
Microsoft Entra authorizes access rights to secured resources through [Azure role-based access control (Azure RBAC)](../role-based-access-control/overview.md).
25-
26-
When an Azure role is assigned to a Microsoft Entra security principal, Azure grants access to those resources for that security principal. Access is scoped to the App Configuration resource. A Microsoft Entra security principal may be a user, a group, an application service principal, or a [managed identity for Azure resources](../active-directory/managed-identities-azure-resources/overview.md).
19+
1. **Authorization**: Pass the token as part of a request to an App Configuration store. To authorize access to the specified App Configuration store, the serurity principal must be assigned the appropriate roles in advance. For more information, see [Microsoft Entra authorization](./rest-api-authorization-azure-ad.md) in App Configuration.
2720

2821
## Azure built-in roles for Azure App Configuration
29-
Azure provides the following Azure built-in roles for authorizing access to App Configuration data using Microsoft Entra ID:
22+
Azure provides the following built-in roles for authorizing access to App Configuration using Microsoft Entra ID:
3023

31-
- **App Configuration Data Owner**: Use this role to give read/write/delete access to App Configuration data. This role doesn't grant access to the App Configuration resource.
24+
### Data plane access
25+
Requests for [data plane](../azure-resource-manager/management/control-plane-and-data-plane.md#data-plane) operations are sent to the endpoint of your App Configuration store. These requests pertain to App Configuration data.
26+
27+
- **App Configuration Data Owner**: Use this role to give read, write, and delete access to App Configuration data. This role doesn't grant access to the App Configuration resource.
3228
- **App Configuration Data Reader**: Use this role to give read access to App Configuration data. This role doesn't grant access to the App Configuration resource.
33-
- **Contributor** or **Owner**: Use this role to manage the App Configuration resource. It grants access to the resource's access keys. While the App Configuration data can be accessed using access keys, this role doesn't grant direct access to the data using Microsoft Entra ID. This role is required if you access the App Configuration data via ARM template, Bicep, or Terraform during deployment. For more information, see [deployment](quickstart-deployment-overview.md).
29+
30+
### Control plane access
31+
All requests for [control plane](../azure-resource-manager/management/control-plane-and-data-plane.md#control-plane) operations are sent to the Azure Resource Manager URL. These requests pertain to the App Configuration resource.
32+
33+
- **Contributor** or **Owner**: Use this role to manage the App Configuration resource. It grants access to the resource's access keys. While the App Configuration data can be accessed using access keys, this role doesn't grant direct access to the data using Microsoft Entra ID.
3434
- **Reader**: Use this role to give read access to the App Configuration resource. This role doesn't grant access to the resource's access keys, nor to the data stored in App Configuration.
3535

3636
> [!NOTE]
3737
> After a role assignment is made for an identity, allow up to 15 minutes for the permission to propagate before accessing data stored in App Configuration using this identity.
3838
39+
## Authentication with Token Credentials
40+
41+
To enable your application to authenticate with Microsoft Entra ID, the Azure Identity library supports various token credentials for Microsoft Entra ID authentication. For example, you might choose Visual Studio Credential when developing your application in Visual Studio, Workload Identity Credential when your application runs on Kubernetes, or Managed Identity Credential when your application is deployed in Azure services like Azure Functions.
42+
43+
### Use DefaultAzureCredential
44+
45+
The `DefaultAzureCredential` is a preconfigured [chain of token credentials](/dotnet/azure/sdk/authentication/credential-chains.md#defaultazurecredential-overview) that automatically attempts an ordered sequence of the most common authentication methods. Using the `DefaultAzureCredential` allows you to keep the same code in both local development and Azure environments. However, it's important to know which credential is being used in each environment, as you need to grant the appropriate roles for authorization to work. For example, authorize your own account when you expect the `DefaultAzureCredential` to fall back to your user identity during local development. Similarly, enable managed identity in Azure Functions and assign it the necessary role when you expect the `DefaultAzureCredential` to fall back to the `ManagedIdentityCredential` when your Function App runs in Azure.
46+
47+
### Assign App Configuration Data Roles
48+
49+
Regardless of which credential you use, you must assign it the appropriate roles before it can access your App Configuration store. If your application only needs to read data from your App Configuration store, assign it the *App Configuration Data Reader* role. If your application also needs to write data to your App Configuration store, assign it the *App Configuration Data Owner* role.
50+
51+
Follow these steps to assign App Configuration Data roles to your credential.
52+
53+
1. In the Azure portal, navigate to your App Configuration store and select **Access control (IAM)**.
54+
1. Select **Add** -> **Add role assignment**.
55+
56+
If you don't have permission to assign roles, the **Add role assignment** option will be disabled. Only users with *Owner* or *User Access Administrator* roles can make role assignments.
57+
2. On the **Role** tab, select the **App Configuration Data Reader** role (or another App Configuration role as appropriate) and then select **Next**.
58+
3. On the **Members** tab, follow the wizard to select the credential you are granting access to and then select **Next**.
59+
4. Finally, on the **Review + assign** tab, select **Review + assign** to assign the role.
60+
3961
## Next steps
40-
Learn more about using [managed identities](howto-integrate-azure-managed-service-identity.md) to administer your App Configuration service.
62+
Learn how to [use managed identities to access your App Configuration store](howto-integrate-azure-managed-service-identity.md).

articles/azure-app-configuration/quickstart-azure-functions-csharp.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,17 @@ This project will use [dependency injection in .NET Azure Functions](../azure-fu
178178

179179
## Test the function locally
180180

181-
1. Set an environment variable named **ConnectionString**, and set it to the access key to your App Configuration store. If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
181+
1. Set an environment variable named **ConnectionString**, and set it to the access key to your App Configuration store.
182182

183+
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
184+
183185
```cmd
184186
setx ConnectionString "connection-string-of-your-app-configuration-store"
185187
```
186188

187-
If you use Windows PowerShell, run the following command:
189+
If you use PowerShell, run the following command:
188190

189-
```azurepowershell
191+
```powershell
190192
$Env:ConnectionString = "connection-string-of-your-app-configuration-store"
191193
```
192194

articles/azure-app-configuration/quickstart-dotnet-core-app.md

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: azure-app-configuration
77
ms.devlang: csharp
88
ms.topic: quickstart
99
ms.custom: devx-track-csharp, mode-other, devx-track-dotnet
10-
ms.date: 02/20/2024
10+
ms.date: 10/05/2024
1111
ms.author: malev
1212
#Customer intent: As a .NET developer, I want to manage all my app settings in one place.
1313
---
@@ -43,73 +43,117 @@ You can use the [.NET command-line interface (CLI)](/dotnet/core/tools/) to crea
4343
4444
## Connect to an App Configuration store
4545
46-
1. Add a reference to the `Microsoft.Extensions.Configuration.AzureAppConfiguration` NuGet package by running the following command:
46+
You can connect to your App Configuration store using Microsoft Entra ID (recommended), or a connection string
4747
48+
1. Add NuGet package references by running the following command:
49+
50+
### [Microsoft Entra ID](#tab/entra-id)
4851
```dotnetcli
4952
dotnet add package Microsoft.Extensions.Configuration.AzureAppConfiguration
53+
dotnet add package Azure.Identity
5054
```
5155
56+
### [Connection string](#tab/connection-string)
57+
```dotnetcli
58+
dotnet add package Microsoft.Extensions.Configuration.AzureAppConfiguration
59+
```
60+
---
61+
5262
1. Run the following command to restore packages for your project:
5363
5464
```dotnetcli
5565
dotnet restore
5666
```
5767
58-
1. Open *Program.cs*, and add the following statements:
68+
1. Open the *Program.cs* file, and add the following namespaces:
69+
5970
71+
### [Microsoft Entra ID](#tab/entra-id)
6072
```csharp
6173
using Microsoft.Extensions.Configuration;
6274
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
75+
using Azure.Identity;
6376
```
6477
65-
1. Use App Configuration by calling the `AddAzureAppConfiguration` method in the `Program.cs` file.
78+
### [Connection string](#tab/connection-string)
79+
```csharp
80+
using Microsoft.Extensions.Configuration;
81+
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
82+
```
83+
---
84+
85+
1. Connect to your App Configuration store by calling the `AddAzureAppConfiguration` method in the `Program.cs` file.
86+
87+
### [Microsoft Entra ID](#tab/entra-id)
88+
You can use any token credentials to authenticate to your App Configuration store as appropriate. In this example, you use the `DefaultAzureCredential`. Follow the [instructions](./concept-enable-rbac.md#authentication-with-token-credentials) to assign your credential the **App Configuration Data Reader** role and allow sufficient time for the permission to propagate before running your application.
6689
90+
```csharp
91+
var builder = new ConfigurationBuilder();
92+
builder.AddAzureAppConfiguration(options =>
93+
{
94+
string endpoint = Environment.GetEnvironmentVariable("Endpoint");
95+
options.Connect(new Uri(endpoint), new DefaultAzureCredential());
96+
});
97+
98+
var config = builder.Build();
99+
Console.WriteLine(config["TestApp:Settings:Message"] ?? "Hello world!");
100+
```
101+
102+
### [Connection string](#tab/connection-string)
67103
```csharp
68104
var builder = new ConfigurationBuilder();
69105
builder.AddAzureAppConfiguration(Environment.GetEnvironmentVariable("ConnectionString"));
70106
71107
var config = builder.Build();
72108
Console.WriteLine(config["TestApp:Settings:Message"] ?? "Hello world!");
73109
```
110+
---
74111
75112
## Build and run the app locally
76113
77-
1. Set an environment variable named **ConnectionString**, and set it to the access key to your App Configuration store. At the command line, run the following command:
114+
1. Set an environment variable.
78115
79-
### [Windows command prompt](#tab/windowscommandprompt)
116+
### [Microsoft Entra ID](#tab/entra-id)
117+
Set the environment variable named **Endpoint** to the endpoint of your App Configuration store found under the *Overview* of your store in the Azure portal.
80118
81-
To build and run the app locally using the Windows command prompt, run the following command:
119+
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
82120
83-
```console
84-
setx ConnectionString "connection-string-of-your-app-configuration-store"
121+
```cmd
122+
setx Endpoint "endpoint-of-your-app-configuration-store"
85123
```
86124
87-
Restart the command prompt to allow the change to take effect. Print the value of the environment variable to validate that it's set properly.
125+
If you use PowerShell, run the following command:
88126
89-
### [PowerShell](#tab/powershell)
127+
```powershell
128+
$Env:Endpoint = "endpoint-of-your-app-configuration-store"
129+
```
90130
91-
If you use Windows PowerShell, run the following command:
131+
If you use macOS or Linux, run the following command:
92132
93-
```azurepowershell
94-
$Env:ConnectionString = "connection-string-of-your-app-configuration-store"
133+
```bash
134+
export Endpoint='endpoint-of-your-app-configuration-store'
95135
```
96136
97-
### [macOS](#tab/unix)
137+
### [Connection string](#tab/connection-string)
138+
Set the environment variable named **ConnectionString** to the read-only connection string of your App Configuration store found under *Access keys* of your store in the Azure portal.
98139
99-
If you use macOS, run the following command:
140+
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
100141
101-
```console
102-
export ConnectionString='connection-string-of-your-app-configuration-store'
142+
```cmd
143+
setx ConnectionString "connection-string-of-your-app-configuration-store"
103144
```
104145
105-
### [Linux](#tab/linux)
106-
107-
If you use Linux, run the following command:
146+
If you use PowerShell, run the following command:
108147
109-
```console
110-
export ConnectionString='connection-string-of-your-app-configuration-store'
148+
```powershell
149+
$Env:ConnectionString = "connection-string-of-your-app-configuration-store"
111150
```
112151
152+
If you use macOS or Linux, run the following command:
153+
154+
```bash
155+
export ConnectionString='connection-string-of-your-app-configuration-store'
156+
```
113157
---
114158
115159
1. Run the following command to build the console app:
@@ -124,6 +168,8 @@ You can use the [.NET command-line interface (CLI)](/dotnet/core/tools/) to crea
124168
dotnet run
125169
```
126170
171+
![Quickstart app launch local](./media/quickstarts/dotnet-core-app-run.png)
172+
127173
## Clean up resources
128174
129175
[!INCLUDE [azure-app-configuration-cleanup](../../includes/azure-app-configuration-cleanup.md)]

0 commit comments

Comments
 (0)