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/app-service/app-service-web-tutorial-connect-msi.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -236,6 +236,9 @@ GO
236
236
237
237
Type `EXIT` to return to the Cloud Shell prompt.
238
238
239
+
> [!NOTE]
240
+
> The back-end services of managed identities also [maintains a token cache](overview-managed-identity.md#obtain-tokens-for-azure-resources) that updates the token for a target resource only when it expires. If you make a mistake configuring your SQL Database permissions and try to modify the permissions *after* trying to get a token with your app, you don't actually get a new token with the updated permissions until the cached token expires.
241
+
239
242
### Modify connection string
240
243
241
244
Remember that the same changes you made in *Web.config* or *appsettings.json* works with the managed identity, so the only thing to do is to remove the existing connection string in App Service, which Visual Studio created deploying your app the first time. Use the following command, but replace *\<app-name>* with the name of your app.
Copy file name to clipboardExpand all lines: articles/app-service/overview-managed-identity.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
---
2
2
title: Managed identities
3
-
description: Learn how managed identities work in Azure App Service and Azure Functions, how to configure a managed identity and generate a token for a backend resource.
3
+
description: Learn how managed identities work in Azure App Service and Azure Functions, how to configure a managed identity and generate a token for a back-end resource.
4
4
author: mattchenderson
5
5
6
6
ms.topic: article
7
-
ms.date: 10/30/2019
7
+
ms.date: 03/04/2020
8
8
ms.author: mahender
9
9
ms.reviewer: yevbronsh
10
10
@@ -19,9 +19,9 @@ This topic shows you how to create a managed identity for App Service and Azure
19
19
20
20
Your application can be granted two types of identities:
21
21
- A **system-assigned identity** is tied to your application and is deleted if your app is deleted. An app can only have one system-assigned identity.
22
-
- A **user-assigned identity** is a standalone Azure resource which can be assigned to your app. An app can have multiple user-assigned identities.
22
+
- A **user-assigned identity** is a standalone Azure resource that can be assigned to your app. An app can have multiple user-assigned identities.
23
23
24
-
## Adding a system-assigned identity
24
+
## Add a system-assigned identity
25
25
26
26
Creating an app with a system-assigned identity requires an additional property to be set on the application.
27
27
@@ -44,12 +44,12 @@ To set up a managed identity in the portal, you will first create an application
44
44
To set up a managed identity using the Azure CLI, you will need to use the `az webapp identity assign` command against an existing application. You have three options for running the examples in this section:
45
45
46
46
- Use [Azure Cloud Shell](../cloud-shell/overview.md) from the Azure portal.
47
-
- Use the embedded Azure Cloud Shell via the "Try It" button, located in the topright corner of each code block below.
47
+
- Use the embedded Azure Cloud Shell via the "Try It" button, located in the top-right corner of each code block below.
48
48
-[Install the latest version of Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli) (2.0.31 or later) if you prefer to use a local CLI console.
49
49
50
50
The following steps will walk you through creating a web app and assigning it an identity using the CLI:
51
51
52
-
1. If you're using the Azure CLI in a local console, first sign in to Azure using [az login](/cli/azure/reference-index#az-login). Use an account that is associated with the Azure subscription under which you would like to deploy the application:
52
+
1. If you're using the Azure CLI in a local console, first sign in to Azure using [az login](/cli/azure/reference-index#az-login). Use an account that's associated with the Azure subscription under which you would like to deploy the application:
53
53
54
54
```azurecli-interactive
55
55
az login
@@ -143,10 +143,10 @@ When the site is created, it has the following additional properties:
143
143
}
144
144
```
145
145
146
-
Where `<TENANTID>` and `<PRINCIPALID>` are replaced with GUIDs. The tenantId property identifies what AAD tenant the identity belongs to. The principalId is a unique identifier for the application's new identity. Within AAD, the service principal has the same name that you gave to your App Service or Azure Functions instance.
146
+
The tenantId property identifies what AAD tenant the identity belongs to. The principalId is a unique identifier for the application's new identity. Within AAD, the service principal has the same name that you gave to your App Service or Azure Functions instance.
147
147
148
148
149
-
## Adding a user-assigned identity
149
+
## Add a user-assigned identity
150
150
151
151
Creating an app with a user-assigned identity requires that you create the identity and then add its resource identifier to your app config.
152
152
@@ -227,15 +227,17 @@ When the site is created, it has the following additional properties:
227
227
}
228
228
```
229
229
230
-
Where `<PRINCIPALID>` and `<CLIENTID>` are replaced with GUIDs. The principalId is a unique identifier for the identity which is used for AAD administration. The clientId is a unique identifier for the application's new identity that is used for specifying which identity to use during runtime calls.
230
+
The principalId is a unique identifier for the identity that's used for AAD administration. The clientId is a unique identifier for the application's new identity that's used for specifying which identity to use during runtime calls.
231
231
232
232
233
-
## Obtaining tokens for Azure resources
233
+
## Obtain tokens for Azure resources
234
234
235
235
An app can use its managed identity to get tokens to access other resources protected by AAD, such as Azure Key Vault. These tokens represent the application accessing the resource, and not any specific user of the application.
236
236
237
+
You may need to configure the target resource to allow access from your application. For example, if you request a token to access Key Vault, you need to make sure you have added an access policy that includes your application's identity. Otherwise, your calls to Key Vault will be rejected, even if they include the token. To learn more about which resources support Azure Active Directory tokens, see [Azure services that support Azure AD authentication](../active-directory/managed-identities-azure-resources/services-support-managed-identities.md#azure-services-that-support-azure-ad-authentication).
238
+
237
239
> [!IMPORTANT]
238
-
> You may need to configure the target resource to allow access from your application. For example, if you request a token to access Key Vault, you need to make sure you have added an access policy that includes your application's identity. Otherwise, your calls to Key Vault will be rejected, even if they include the token. To learn more about which resources support Azure Active Directory tokens, see [Azure services that support Azure AD authentication](../active-directory/managed-identities-azure-resources/services-support-managed-identities.md#azure-services-that-support-azure-ad-authentication).
240
+
> The back-end services for managed identities maintain a cache per resource URI for around 8 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.
239
241
240
242
There is a simple REST protocol for obtaining a token in App Service and Azure Functions. This can be used for all applications and languages. For .NET and Java, the Azure SDK provides an abstraction over this protocol and facilitates a local development experience.
241
243
@@ -408,9 +410,9 @@ For Java applications and functions, the simplest way to work with a managed ide
Copy file name to clipboardExpand all lines: articles/container-instances/container-instances-tutorial-azure-function-trigger.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ This article assumes you publish the project using the name *myfunctionapp*, in
37
37
38
38
## Enable an Azure-managed identity in the function app
39
39
40
-
Now enable a system-assigned [managed identity](../app-service/overview-managed-identity.md?toc=/azure/azure-functions/toc.json#adding-a-system-assigned-identity) in your function app. The PowerShell host running the app can automatically authenticate using this identity, enabling functions to take actions on Azure services to which the identity has been granted access. In this tutorial, you grant the managed identity permissions to create resources in the function app's resource group.
40
+
Now enable a system-assigned [managed identity](../app-service/overview-managed-identity.md?toc=/azure/azure-functions/toc.json#add-a-system-assigned-identity) in your function app. The PowerShell host running the app can automatically authenticate using this identity, enabling functions to take actions on Azure services to which the identity has been granted access. In this tutorial, you grant the managed identity permissions to create resources in the function app's resource group.
41
41
42
42
First use the [az group show][az-group-show] command to get the ID of the function app's resource group and store it in an environment variable. This example assumes you run the command in a Bash shell.
0 commit comments