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
# Use managed identities to access App Configuration
13
14
14
15
Azure Active Directory [managed identities](../active-directory/managed-identities-azure-resources/overview.md) simplify secrets management for your cloud application. With a managed identity, your code can use the service principal created for the Azure service it runs on. You use a managed identity instead of a separate credential stored in Azure Key Vault or a local connection string.
15
16
16
17
Azure App Configuration and its .NET Core, .NET Framework, and Java Spring client libraries have managed identity support built into them. Although you aren't required to use it, the managed identity eliminates the need for an access token that contains secrets. Your code can access the App Configuration store using only the service endpoint. You can embed this URL in your code directly without exposing any secret.
17
18
19
+
:::zone target="docs" pivot="framework-dotnet"
20
+
18
21
This article shows how you can take advantage of the managed identity to access App Configuration. It builds on the web app introduced in the quickstarts. Before you continue, [Create an ASP.NET Core app with App Configuration](./quickstart-aspnet-core-app.md) first.
19
22
23
+
:::zone-end
24
+
25
+
:::zone target="docs" pivot="framework-spring"
26
+
27
+
This article shows how you can take advantage of the managed identity to access App Configuration. It builds on the web app introduced in the quickstarts. Before you continue, [Create a Java Spring app with Azure App Configuration](./quickstart-java-spring-app.md) first.
28
+
29
+
:::zone-end
30
+
20
31
> [!IMPORTANT]
21
32
> Managed Identity cannot be used to authenticate locally-running applications. Your application must be deployed to an Azure service that supports Managed Identity. This article uses Azure App Service as an example, but the same concept applies to any other Azure service that supports managed identity, for example, [Azure Kubernetes Service](../aks/use-azure-ad-pod-identity.md), [Azure Virtual Machine](../active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm.md), and [Azure Container Instances](../container-instances/container-instances-managed-identity.md). If your workload is hosted in one of those services, you can leverage the service's managed identity support, too.
22
33
@@ -28,14 +39,25 @@ In this article, you learn how to:
28
39
> * Grant a managed identity access to App Configuration.
29
40
> * Configure your app to use a managed identity when you connect to App Configuration.
@@ -66,16 +88,18 @@ The following steps describe how to assign the App Configuration Data Reader rol
66
88
67
89
1. On the **Role** tab, select the **App Configuration Data Reader** role.
68
90
69
-

91
+

70
92
71
93
1. On the **Members** tab, select **Managed identity**, and then select **Select members**.
72
94
73
-
1. Select your Azure subscription, select **System-assigned managed identity**, and then select **App Service**.
95
+
1. Select your Azure subscription, for Managed Identity select **App Service**, then select your App Service name.
74
96
75
97
1. On the **Review + assign** tab, select **Review + assign** to assign the role.
76
98
77
99
## Use a managed identity
78
100
101
+
:::zone target="docs" pivot="framework-dotnet"
102
+
79
103
1. Add a reference to the *Azure.Identity* package:
80
104
81
105
```bash
@@ -158,13 +182,38 @@ The following steps describe how to assign the App Configuration Data Reader rol
158
182
> });
159
183
>```
160
184
>As explained in the [Managed Identities forAzure resources FAQs](../active-directory/managed-identities-azure-resources/known-issues.md), there is a default way to resolve which managed identity is used. In this case, the Azure Identity library enforces you to specify the desired identity to avoid posible runtime issuesin the future (for instance, if a new user-assigned managed identity is added or if the system-assigned managed identity is enabled). So, you will need to specify the clientId even if only one user-assigned managed identity is defined, and there is no system-assigned managed identity.
161
-
162
-
185
+
186
+
:::zone-end
187
+
188
+
:::zone target="docs" pivot="framework-spring"
189
+
190
+
1. Find the endpoint to your App Configuration store. This URL is listed on the **Overview** tab forthe storein the Azure portal.
191
+
192
+
1. Open `bootstrap.properties`, remove the connection-string property and replace it with endpoint:
> If you want to use **user-assigned managed identity** the property `spring.cloud.azure.appconfiguration.stores[0].managed-identity.client-id`, be sure to specify the clientId when creating the [ManagedIdentityCredential](/java/api/com.azure.identity.managedidentitycredential).
200
+
201
+
:::zone-end
163
202
164
203
## Deploy your application
165
204
205
+
:::zone target="docs" pivot="framework-dotnet"
206
+
166
207
Using managed identities requires you to deploy your app to an Azure service. Managed identities can't be used for authentication of locally-running apps. To deploy the .NET Core app that you created in the [Create an ASP.NET Core app with App Configuration](./quickstart-aspnet-core-app.md) quickstart and modified to use managed identities, follow the guidance in [Publish your web app](../app-service/quickstart-dotnetcore.md?pivots=development-environment-vs&tabs=netcore31#publish-your-web-app).
167
208
209
+
:::zone-end
210
+
211
+
:::zone target="docs" pivot="framework-spring"
212
+
213
+
Using managed identities requires you to deploy your app to an Azure service. Managed identities can't be used forauthentication of locally-running apps. To deploy the Spring app that you createdin the [Create a Java Spring app with Azure App Configuration](./quickstart-java-spring-app.md) quickstart and modified to use managed identities, follow the guidance in [Publish your web app](../app-service/quickstart-java.md?tabs=javase&pivots=platform-linux).
214
+
215
+
:::zone-end
216
+
168
217
In addition to App Service, many other Azure services support managed identities. For more information, see [Services that support managed identities for Azure resources](../active-directory/managed-identities-azure-resources/services-support-managed-identities.md).
0 commit comments