Skip to content

Commit aa72e11

Browse files
Update managed-identity.md
1 parent d2b0dca commit aa72e11

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

articles/container-apps/managed-identity.md

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A managed identity from Microsoft Entra ID allows your container app to access o
1717
Your container app can be granted two types of identities:
1818

1919
- A **system-assigned identity** is tied to your container app and is deleted when your container app is deleted. An app can only have one system-assigned identity.
20-
- A **user-assigned identity** is a standalone Azure resource that can be assigned to your container app and other resources. A container app can have multiple user-assigned identities. The identity exists until you delete them.
20+
- A **user-assigned identity** is a standalone Azure resource that you can assign to your container app and other resources. A container app can have multiple user-assigned identities. User-assigned identities exist until you delete them.
2121

2222
## Why use a managed identity?
2323

@@ -28,9 +28,9 @@ With managed identities:
2828
- Your app connects to resources with the managed identity. You don't need to manage credentials in your container app.
2929
- You can use role-based access control to grant specific permissions to a managed identity.
3030
- System-assigned identities are automatically created and managed. They're deleted when your container app is deleted.
31-
- You can add and delete user-assigned identities and assign them to multiple resources. They're independent of your container app's life cycle.
32-
- You can use managed identity to [authenticate with a private Azure Container Registry](./managed-identity-image-pull.md) without a username and password to pull containers for your Container App.
33-
- You can use [managed identity to create connections for Dapr-enabled applications via Dapr components](./dapr-overview.md)
31+
- You can add and delete user-assigned identities and assign them to multiple resources. They're independent of your container app's lifecycle.
32+
- You can use managed identity to [authenticate with a private Azure Container Registry](./managed-identity-image-pull.md) without a username and password to pull containers for your container app.
33+
- You can use a [managed identity to create connections for Dapr-enabled applications via Dapr components](./dapr-overview.md)
3434

3535
### Common use cases
3636

@@ -46,9 +46,8 @@ User-assigned identities are ideal for workloads that:
4646

4747
## Limitations
4848

49-
Using managed identities in scale rules isn't supported. You'll still need to include the connection string or key in the `secretRef` of the scaling rule.
50-
51-
[Init containers](containers.md#init-containers) can't access managed identities.
49+
- Managed identities in scale rules isn't supported. You need to include connection strings or keys in the `secretRef` of the scaling rule.
50+
- [Init containers](containers.md#init-containers) can't access managed identities.
5251

5352
## Configure managed identities
5453

@@ -67,11 +66,13 @@ When a managed identity is added, deleted, or modified on a running container ap
6766

6867
# [Azure portal](#tab/portal)
6968

70-
1. In the left navigation of your container app's page, scroll down to the **Settings** group.
69+
1. Go to your container app in the Azure portal.
70+
71+
1. From the *Settings* group, select **Identity**.
7172

72-
1. Select **Identity**.
73+
1. Within the *System assigned* tab, switch *Status* to **On**.
7374

74-
1. Within the **System assigned** tab, switch **Status** to **On**. Select **Save**.
75+
1. Select **Save**.
7576

7677
:::image type="content" source="media/managed-identity/screenshot-system-assigned-identity.png" alt-text="Screenshot of system-assigned identities.":::
7778

@@ -118,13 +119,15 @@ First, you'll need to create a user-assigned identity resource.
118119
119120
1. Create a user-assigned managed identity resource according to the steps found in [Manage user-assigned managed identities](../active-directory/managed-identities-azure-resources/how-to-manage-ua-identity-portal.md#create-a-user-assigned-managed-identity).
120121
121-
1. In the left navigation for your container app's page, scroll down to the **Settings** group.
122+
1. Go to your container app in the Azure portal.
122123
123-
1. Select **Identity**.
124+
1. From the *Settings* group, select **Identity**.
124125
125-
1. Within the **User assigned** tab, select **Add**.
126+
1. Within the *User assigned* tab, select **Add**.
126127
127-
1. Search for the identity you created earlier and select it. Select **Add**.
128+
1. Search for and select the identity you created earlier.
129+
130+
1. Select **Add**.
128131
129132
:::image type="content" source="media/managed-identity/screenshot-user-assigned-identity.png" alt-text="Screenshot of user-assigned identities.":::
130133
@@ -166,7 +169,7 @@ Specify each user-assigned identity by adding an item to the `userAssignedIdenti
166169
For a complete ARM template example, see [ARM API Specification](azure-resource-manager-api-spec.md?tabs=arm-template#container-app-examples).
167170

168171
> [!NOTE]
169-
> An application can have both system-assigned and user-assigned identities at the same time. In this case, the type property would be `SystemAssigned,UserAssigned`.
172+
> An application can have both system-assigned and user-assigned identities at the same time. In this case, the value for `type` property would be `SystemAssigned,UserAssigned`.
170173
171174
# [YAML](#tab/yaml)
172175

@@ -191,64 +194,64 @@ For a complete YAML template example, see [ARM API Specification](azure-resource
191194

192195
## Configure a target resource
193196

194-
For some resources, you'll need to configure role assignments for your app's managed identity to grant access. Otherwise, calls from your app to services, such as Azure Key Vault and Azure SQL Database, will be rejected even if you use a valid token for that identity. To learn more about Azure role-based access control (Azure RBAC), see [What is RBAC?](../role-based-access-control/overview.md). To learn more about which resources support Microsoft Entra tokens, see [Azure services that support Microsoft Entra authentication](../active-directory/managed-identities-azure-resources/services-support-managed-identities.md#azure-services-that-support-azure-ad-authentication).
197+
For some resources, you need to configure role assignments for your app's managed identity to grant access. Otherwise, calls from your app to services, such as Azure Key Vault and Azure SQL Database, are rejected even when you use a valid token for that identity. To learn more about Azure role-based access control (Azure RBAC), see [What is RBAC?](../role-based-access-control/overview.md). To learn more about which resources support Microsoft Entra tokens, see [Azure services that support Microsoft Entra authentication](../active-directory/managed-identities-azure-resources/services-support-managed-identities.md#azure-services-that-support-azure-ad-authentication).
195198

196199
> [!IMPORTANT]
197-
> The back-end services for managed identities maintain a cache per resource URI for around 24 hours. If you update the access policy of a particular target resource and immediately retrieve a token for that resource, you may continue to get a cached token with outdated permissions until that token expires. There's currently no way to force a token refresh.
200+
> The back-end services for managed identities maintain a cache per resource URI for around 24 hours. If you update the access policy of a particular target resource and immediately retrieve a token for that resource, you may continue to get a cached token with outdated permissions until that token expires. Forcing a token refresh isn't supported.
198201

199202
## Connect to Azure services in app code
200203

201204
With managed identities, an app can obtain tokens to access Azure resources that use Microsoft Entra ID, such as Azure SQL Database, Azure Key Vault, and Azure Storage. These tokens represent the application accessing the resource, and not any specific user of the application.
202205

203-
Container Apps provides an internally accessible [REST endpoint](managed-identity.md?tabs=cli%2Chttp#rest-endpoint-reference) to retrieve tokens. The REST endpoint can be accessed from within the app with a standard HTTP GET, which can be implemented with a generic HTTP client in every language. For .NET, JavaScript, Java, and Python, the Azure Identity client library provides an abstraction over this REST endpoint. Connecting to other Azure services is as simple as adding a credential object to the service-specific client.
206+
Container Apps provides an internally accessible [REST endpoint](managed-identity.md?tabs=cli%2Chttp#rest-endpoint-reference) to retrieve tokens. The REST endpoint is availasble from within the app with a standard HTTP `GET` request, which you can implement with a generic HTTP client in your preferred language. For .NET, JavaScript, Java, and Python, the Azure Identity client library provides an abstraction over this REST endpoint. You can connect to other Azure services by adding a credential object to the service-specific client.
204207

205208
> [!NOTE]
206-
> When using Azure Identity client library, the user-assigned managed identity client id must be specified.
209+
> When using Azure Identity client library, you need to explicitly specify the user-assigned managed identity client id.
207210

208211
# [.NET](#tab/dotnet)
209212

210213
> [!NOTE]
211-
> When connecting to Azure SQL data sources with [Entity Framework Core](/ef/core/), consider [using Microsoft.Data.SqlClient](/sql/connect/ado-net/sql/azure-active-directory-authentication), which provides special connection strings for managed identity connectivity.
214+
> When connecting to Azure SQL data sources with [Entity Framework Core](/ef/core/), consider using [Microsoft.Data.SqlClient](/sql/connect/ado-net/sql/azure-active-directory-authentication), which provides special connection strings for managed identity connectivity.
212215

213-
For .NET apps, the simplest way to work with a managed identity is through the [Azure Identity client library for .NET](/dotnet/api/overview/azure/identity-readme). See the respective documentation headings of the client library for information:
216+
For .NET apps, the simplest way to work with a managed identity is through the [Azure Identity client library for .NET](/dotnet/api/overview/azure/identity-readme). See the following resources for more information:
214217

215218
- [Add Azure Identity client library to your project](/dotnet/api/overview/azure/identity-readme#getting-started)
216219
- [Access Azure service with a system-assigned identity](/dotnet/api/overview/azure/identity-readme#authenticating-with-defaultazurecredential)
217220
- [Access Azure service with a user-assigned identity](/dotnet/api/overview/azure/identity-readme#specify-a-user-assigned-managed-identity-with-defaultazurecredential)
218221

219-
The linked examples use [`DefaultAzureCredential`](/dotnet/api/overview/azure/identity-readme#defaultazurecredential). It's useful for most the scenarios because the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
222+
The linked examples use [`DefaultAzureCredential`](/dotnet/api/overview/azure/identity-readme#defaultazurecredential). This object is effective in most scenarios as the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
220223

221224
# [JavaScript](#tab/javascript)
222225

223-
For Node.js apps, the simplest way to work with a managed identity is through the [Azure Identity client library for JavaScript](/javascript/api/overview/azure/identity-readme?). See the respective documentation headings of the client library for information:
226+
For Node.js apps, the simplest way to work with a managed identity is through the [Azure Identity client library for JavaScript](/javascript/api/overview/azure/identity-readme?). See the following resources for more information:
224227

225228
- [Add Azure Identity client library to your project](/javascript/api/overview/azure/identity-readme#install-the-package)
226229
- [Access Azure service with a system-assigned identity](/javascript/api/overview/azure/identity-readme#authenticating-with-defaultazurecredential)
227230
- [Access Azure service with a user-assigned identity](/javascript/api/overview/azure/identity-readme#authenticating-a-user-assigned-managed-identity-with-defaultazurecredential)
228231

229-
The linked examples use [`DefaultAzureCredential`](/javascript/api/overview/azure/identity-readme#defaultazurecredential). It's useful for most the scenarios because the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
232+
The linked examples use [`DefaultAzureCredential`](/javascript/api/overview/azure/identity-readme#defaultazurecredential). This object is effective in most scenarios as the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
230233

231234
For more code examples of the Azure Identity client library for JavaScript, see [Azure Identity examples](https://github.com/Azure/azure-sdk-for-js/blob/%40azure/identity_2.0.1/sdk/identity/identity/samples/AzureIdentityExamples.md).
232235

233236
# [Python](#tab/python)
234237

235-
For Python apps, the simplest way to work with a managed identity is through the [Azure Identity client library for Python](/python/api/overview/azure/identity-readme). See the respective documentation headings of the client library for information:
238+
For Python apps, the simplest way to work with a managed identity is through the [Azure Identity client library for Python](/python/api/overview/azure/identity-readme). See the following resources for more information:
236239

237240
- [Add Azure Identity client library to your project](/python/api/overview/azure/identity-readme#getting-started)
238241
- [Access Azure service with a system-assigned identity](/python/api/overview/azure/identity-readme#authenticating-with-defaultazurecredential)
239242
- [Access Azure service with a user-assigned identity](/python/api/overview/azure/identity-readme#authenticating-a-user-assigned-managed-identity-with-defaultazurecredential)
240243

241-
The linked examples use [`DefaultAzureCredential`](/python/api/overview/azure/identity-readme#defaultazurecredential). It's useful for most the scenarios because the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
244+
The linked examples use [`DefaultAzureCredential`](/python/api/overview/azure/identity-readme#defaultazurecredential). This object is effective in most scenarios as the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
242245

243246
# [Java](#tab/java)
244247

245-
For Java apps and functions, the simplest way to work with a managed identity is through the [Azure Identity client library for Java](/java/api/overview/azure/identity-readme). See the respective documentation headings of the client library for information:
248+
For Java apps and functions, the simplest way to work with a managed identity is through the [Azure Identity client library for Java](/java/api/overview/azure/identity-readme). See the following resources for more information:
246249

247250
- [Add Azure Identity client library to your project](/java/api/overview/azure/identity-readme#include-the-package)
248251
- [Access Azure service with a system-assigned identity](/java/api/overview/azure/identity-readme#authenticating-with-defaultazurecredential)
249252
- [Access Azure service with a user-assigned identity](/java/api/overview/azure/identity-readme#authenticating-a-user-assigned-managed-identity-with-defaultazurecredential)
250253

251-
The linked examples use [`DefaultAzureCredential`](/azure/developer/java/sdk/identity-azure-hosted-auth#default-azure-credential). It's useful for most the scenarios because the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
254+
The linked examples use [`DefaultAzureCredential`](/azure/developer/java/sdk/identity-azure-hosted-auth#default-azure-credential). This object is effective in most scenarios as the same pattern works in Azure (with managed identities) and on your local machine (without managed identities).
252255

253256
For more code examples of the Azure Identity client library for Java, see [Azure Identity Examples](https://github.com/Azure/azure-sdk-for-java/wiki/Azure-Identity-Examples).
254257

@@ -265,7 +268,7 @@ $accessToken = $tokenResponse.access_token
265268

266269
# [HTTP GET](#tab/http)
267270

268-
A raw HTTP GET request looks like the following example.
271+
A raw HTTP `GET` request looks like the following example.
269272

270273
Obtain the token endpoint URL from the `IDENTITY_ENDPOINT` environment variable. `x-identity-header` contains the GUID that is stored in the `IDENTITY_HEADER` environment variable.
271274

@@ -290,16 +293,16 @@ Content-Type: application/json
290293
291294
```
292295

293-
This response is the same as the [response for the Microsoft Entra service-to-service access token request](../active-directory/develop/v2-oauth2-client-creds-grant-flow.md#successful-response). To access Key Vault, you'll then add the value of `access_token` to a client connection with the vault.
296+
This response is the same as the [response for the Microsoft Entra service-to-service access token request](../active-directory/develop/v2-oauth2-client-creds-grant-flow.md#successful-response). To access Key Vault, add the value of `access_token` to a client connection with the vault.
294297

295298
### REST endpoint reference
296299

297300
A container app with a managed identity exposes the identity endpoint by defining two environment variables:
298301

299-
- `IDENTITY_ENDPOINT` - local URL from which your container app can request tokens.
300-
- `IDENTITY_HEADER` - a header used to help mitigate server-side request forgery (SSRF) attacks. The value is rotated by the platform.
302+
- `IDENTITY_ENDPOINT`: Local URL from which your container app can request tokens.
303+
- `IDENTITY_HEADER`: A header used to help mitigate server-side request forgery (SSRF) attacks. The value is rotated by the platform.
301304

302-
To get a token for a resource, make an HTTP GET request to the endpoint, including the following parameters:
305+
To get a token for a resource, make an HTTP `GET` request to the endpoint, including the following parameters:
303306

304307
| Parameter name | In | Description |
305308
| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

0 commit comments

Comments
 (0)