Skip to content

Commit f5dc7c0

Browse files
authored
Merge pull request #106464 from cephalin/issue43368
#43368
2 parents 5d25eea + db89dc3 commit f5dc7c0

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

articles/app-service/app-service-web-tutorial-connect-msi.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ GO
236236

237237
Type `EXIT` to return to the Cloud Shell prompt.
238238

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+
239242
### Modify connection string
240243

241244
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.

articles/app-service/overview-managed-identity.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
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 back end 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.
44
author: mattchenderson
55

66
ms.topic: article
7-
ms.date: 10/30/2019
7+
ms.date: 03/04/2020
88
ms.author: mahender
99
ms.reviewer: yevbronsh
1010

@@ -19,9 +19,9 @@ This topic shows you how to create a managed identity for App Service and Azure
1919

2020
Your application can be granted two types of identities:
2121
- 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.
2323

24-
## Adding a system-assigned identity
24+
## Add a system-assigned identity
2525

2626
Creating an app with a system-assigned identity requires an additional property to be set on the application.
2727

@@ -44,12 +44,12 @@ To set up a managed identity in the portal, you will first create an application
4444
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:
4545

4646
- 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 top right 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.
4848
- [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.
4949

5050
The following steps will walk you through creating a web app and assigning it an identity using the CLI:
5151

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:
5353

5454
```azurecli-interactive
5555
az login
@@ -143,10 +143,10 @@ When the site is created, it has the following additional properties:
143143
}
144144
```
145145

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.
147147

148148

149-
## Adding a user-assigned identity
149+
## Add a user-assigned identity
150150

151151
Creating an app with a user-assigned identity requires that you create the identity and then add its resource identifier to your app config.
152152

@@ -227,15 +227,17 @@ When the site is created, it has the following additional properties:
227227
}
228228
```
229229

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.
231231

232232

233-
## Obtaining tokens for Azure resources
233+
## Obtain tokens for Azure resources
234234

235235
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.
236236

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+
237239
> [!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.
239241
240242
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.
241243

@@ -408,9 +410,9 @@ For Java applications and functions, the simplest way to work with a managed ide
408410
```
409411

410412

411-
## <a name="remove"></a>Removing an identity
413+
## <a name="remove"></a>Remove an identity
412414

413-
A system-assigned identity can be removed by disabling the feature using the portal, PowerShell, or CLI in the same way that it was created. User-assigned identities can be removed individually. To remove all identities, in the REST/ARM template protocol, this is done by setting the type to "None":
415+
A system-assigned identity can be removed by disabling the feature using the portal, PowerShell, or CLI in the same way that it was created. User-assigned identities can be removed individually. To remove all identities, set the type to "None" in the [ARM template](#using-an-azure-resource-manager-template):
414416

415417
```json
416418
"identity": {

articles/container-instances/container-instances-tutorial-azure-function-trigger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This article assumes you publish the project using the name *myfunctionapp*, in
3737

3838
## Enable an Azure-managed identity in the function app
3939

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.
4141

4242
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.
4343

0 commit comments

Comments
 (0)