Skip to content

Commit 2eddf2b

Browse files
committed
updates per docs
1 parent 27f686b commit 2eddf2b

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

articles/cosmos-db/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,8 @@
10101010
href: how-to-configure-cross-origin-resource-sharing.md
10111011
- name: Secure Azure Cosmos keys using Key Vault
10121012
href: access-secrets-from-keyvault.md
1013+
- name: Secure Azure Cosmos Keys using Managed Identity
1014+
href: managed-identity-based-authentication.md
10131015
- name: Certificate-based authentication with Azure AD
10141016
href: certificate-based-authentication.md
10151017
- name: Restrict user access to data operations only

articles/cosmos-db/managed-identity-based-authentication.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Managed Identity based authentication and authorization with Azure Cosmos DB and Azure Active Directory
3-
description: Learn how to configure an Azure AD identity to access keys from Azure Cosmos DB.
2+
title: System-Assigned Managed Identity based key access using Azure Active Directory
3+
description: Learn how to configure an Azure AD system-assigned managed identity to access keys from Azure Cosmos DB.
44
author: j-patrick
55
ms.service: cosmos-db
66
ms.topic: conceptual
@@ -10,33 +10,33 @@ ms.reviewer: sngun
1010

1111
---
1212

13-
# Managed Identity based authentication and authorization with Azure Cosmos DB and Azure Active Directory
13+
# System-Assigned Managed Identity based key access using Azure Active Directory
1414

1515
In this article we'll setup a **robust, key rotation agnostic,** solution for Cosmos DB key management by leveraging [Managed Service Identities](../active-directory/managed-identities-azure-resources/services-support-managed-identities.md). Though we're using an Azure Function for this example, this solution can be used with any service that [supports managed service identities](../active-directory/managed-identities-azure-resources/services-support-managed-identities.md).
1616

1717
You'll learn how to:
1818

19-
* Assign a System Identity
20-
* Grant the System Identity access to your Cosmos DB
19+
* Assign a System-Assigned Managed Identity
20+
* Grant the System-Assigned Managed Identity access to your Cosmos DB
2121
* Write the code for robust Cosmos DB key management
2222

2323
In the solution below, we'll be building an Azure Function that will handle summarizing the last hour of sales. The function will wake up every hour, and will read a set of sale receipts from Cosmos DB. Then the function will create an hourly summary of sales and store it back in the container. To simplify the scenario, cleanup of the already processed receipts will be handled by an already configured [TTL](./time-to-live.md) setting.
2424

25-
## Assign a System Identity to an Azure Function
25+
## Assign a System-Assigned Managed Identity to an Azure Function
2626

27-
In this step, you'll assign a managed system identity to your Azure Function.
27+
In this step, you'll assign a system-assigned managed identity to your Azure Function.
2828

2929
1. Sign into the [Azure portal](https://portal.azure.com/)
3030

3131
1. Open the Azure Function pane, and for your function app select the **Identity tab**:
3232
![Identity Tab](./media/managed-identity-based-authentication/identity-tab-selection.png)
3333

3434
1. On the **Identity tab** switch **System Identity** to the "On" position. Be sure to click **Save**, and confirm you want to turn on System Identity. In the end the **System Identity** pane should look like this:
35-
![Managed System Identity turned on](./media/managed-identity-based-authentication/identity-tab-system-managed-on.png)
35+
![System Identity turned on](./media/managed-identity-based-authentication/identity-tab-system-managed-on.png)
3636

37-
## Grant the System Identity Access to your Cosmos DB
37+
## Grant the System-Assigned Managed Identity Access to your Cosmos DB
3838

39-
In this step, you'll assign a role to the Azure Function's System Identity. Cosmos DB has multiple built-in roles you can assign the System Identity too. For this exercise we'll just focus on two:
39+
In this step, you'll assign a role to the Azure Function's System-Assigned Managed Identity. Cosmos DB has multiple built-in roles you can assign the System Identity too. For this exercise we'll just focus on two:
4040

4141
|**Built-in role** |**Description** |
4242
|---------|---------|
@@ -47,7 +47,7 @@ In this step, you'll assign a role to the Azure Function's System Identity. Cosm
4747
> RBAC support in Azure Cosmos DB applies to control plane operations only. Data plane operations are secured using master keys or resource tokens. To learn more, see [Secure access to data in Azure Cosmos DB](secure-access-to-data.md)
4848
4949
> [!TIP]
50-
> When assigning roles, only assign the needed access. So if your service only need to read, then only assign the Service Identity to **Cosmos DB Account Reader**. For more information about the importance of **least privilege access,** see [lower exposure of privileged accounts](../security/fundamentals/identity-management-best-practices.md#lower-exposure-of-privileged-accounts).
50+
> When assigning roles, only assign the needed access. So if your service only need to read, then only assign the Service Managed Identity to **Cosmos DB Account Reader**. For more information about the importance of **least privilege access,** see [lower exposure of privileged accounts](../security/fundamentals/identity-management-best-practices.md#lower-exposure-of-privileged-accounts).
5151
5252
For our scenario, we'll read the sale receipt documents, summarize them, and then write back that summary to Cosmos DB. Since we need write access, we'll use the **DocumentDB Account Contributor** role.
5353

@@ -61,15 +61,15 @@ For our scenario, we'll read the sale receipt documents, summarize them, and the
6161
![Add Role Assignment Pane](./media/managed-identity-based-authentication/cosmos-db-iam-tab-add-role-pane.png)
6262

6363
* **Role** - Select **DocumentDB Account Contributor**
64-
* **Assign access to** - Under the Select **System assigned managed identity** subsection, select **Function App**.
65-
* **Select** - The pane will be populated with all the function apps, in your subscription, that have a **System Managed Identity**. In our case I select the **SummaryService** function app:
64+
* **Assign access to** - Under the Select **System-assigned managed identity** subsection, select **Function App**.
65+
* **Select** - The pane will be populated with all the function apps, in your subscription, that have a **Managed System Identity**. In our case I select the **SummaryService** function app:
6666
![Selection of Function App](./media/managed-identity-based-authentication/cosmos-db-iam-tab-add-role-pane-filled.png)
6767

6868
1. Select the function app and click **Save**.
6969

7070
## Programmatically access the Cosmos DB keys from the Azure Function
7171

72-
Now we have a function app that has a system managed identity. That identity is given the **DocumentDB Account Contributor** role in the Cosmos DB permissions. The **Function App** code below will get the needed Cosmos DB Keys, create a CosmosClient, and run the summarization business logic.
72+
Now we have a function app that has a system-assigned managed identity. That identity is given the **DocumentDB Account Contributor** role in the Cosmos DB permissions. The **Function App** code below will get the needed Cosmos DB Keys, create a CosmosClient, and run the summarization business logic.
7373

7474
We'll be using to get the Cosmos DB Keys is the [List Keys API](https://docs.microsoft.com/rest/api/cosmos-db-resource-provider/DatabaseAccounts/ListKeys).
7575

@@ -88,7 +88,7 @@ namespace SummarizationService
8888
}
8989
```
9090

91-
The library we'll use to get our Service Managed token is [Microsoft.Azure.Services.AppAuthentication](https://www.nuget.org/packages/Microsoft.Azure.Services.AppAuthentication). You can find other ways to get the token and more information about the Microsoft.Azure.Service.AppAuthentication library by reading up on [Service To Service Authentication](../key-vault/service-to-service-authentication.md).
91+
The library we'll use to get our System-Assigned Managed Identity token is [Microsoft.Azure.Services.AppAuthentication](https://www.nuget.org/packages/Microsoft.Azure.Services.AppAuthentication). You can find other ways to get the token and more information about the Microsoft.Azure.Service.AppAuthentication library by reading up on [Service To Service Authentication](../key-vault/service-to-service-authentication.md).
9292

9393

9494
```csharp
@@ -186,7 +186,7 @@ namespace SummarizationService
186186
You are now ready to [deploy your Azure Function.](../azure-functions/functions-create-first-function-vs-code.md)
187187

188188
> [!IMPORTANT]
189-
> If you want to [assign the **Cosmos DB Account Reader**](#grant-the-system-identity-access-to-your-cosmos-db) role, you will need to use the read only [List Keys api](https://docs.microsoft.com/rest/api/cosmos-db-resource-provider/DatabaseAccounts/ListReadOnlyKeys). This would only populate the read only keys on the DatabaseAccountListKeysResult class.
189+
> If you want to [assign the **Cosmos DB Account Reader**](#grant-the-system-assigned-managed-identity-access-to-your-cosmos-db) role, you will need to use the read only [List Keys api](https://docs.microsoft.com/rest/api/cosmos-db-resource-provider/DatabaseAccounts/ListReadOnlyKeys). This would only populate the read only keys on the DatabaseAccountListKeysResult class.
190190
191191
## Next steps
192192

0 commit comments

Comments
 (0)