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
Azure Cosmos DB allows you to isolate and restrict the restore permissions for continuous backup account to a specific role or a principal. The owner of the account can trigger a restore and assign a role to other principals to perform the restore operation. These permissions can be applied at the subscription scope or more granularly at the source account scope as shown in the following image:
15
+
Azure Cosmos DB allows you to isolate and restrict the restore permissions for continuous backup account to a specific role or a principal. The owner of the account can trigger a restore and assign a role to other principals to perform the restore operation. These permissions can be applied at the subscription scope as shown in the following image:
16
16
17
-
:::image type="content" source="./media/continuous-backup-restore-permissions/restore-roles-permissions.png" alt-text="List of roles required to perform restore operation." lightbox="./media/continuous-backup-restore-permissions/restore-roles-permissions.png" border="false":::
17
+
:::image type="content" source="./media/continuous-backup-restore-permissions/restore-roles-permissions.svg" alt-text="List of roles required to perform restore operation." border="false":::
18
18
19
19
Scope is a set of resources that have access, to learn more on scopes, see the [Azure RBAC](../role-based-access-control/scope-overview.md) documentation. In Azure Cosmos DB, applicable scopes are the source subscription and database account for most of the use cases. The principal performing the restore actions should have write permissions to the destination resource group.
20
20
@@ -40,24 +40,29 @@ To perform a restore, a user or a principal need the permission to restore (that
The restorable account resource can be extracted from the output of the `az cosmosdb restorable-database-account list --account-name <accountname>` command in CLI or `Get-AzCosmosDBRestorableDatabaseAccount -DatabaseAccountName <accountname>` cmdlet in PowerShell. The name attribute in the output represents the `instanceID` of the restorable account.
46
-
47
-
## Permissions
48
44
45
+
## Permissions on the source account
49
46
Following permissions are required to perform the different activities pertaining to restore for continuous backup mode accounts:
50
47
51
48
> [!NOTE]
52
-
> Permission can be assigned to restorable database account at account scope or subscription scope. Assigning permissions at resource group scope is not supported.
|`Microsoft.Resources/deployments/validate/action`, `Microsoft.Resources/deployments/write`| These permissions are required for the ARM template deployment to create the restored account. See the sample permission [RestorableAction](#custom-restorable-action) below for how to set this role. | Not applicable | Not applicable |
57
-
|`Microsoft.DocumentDB/databaseAccounts/write`| This permission is required to restore an account into a resource group | Resource group under which the restored account is created. | Subscription under which the restored account is created |
58
-
|`Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restore/action` </br> You can't choose resource group as the permission scope. |This permission is required on the source restorable database account scope to allow restore actions to be performed on it. | The *RestorableDatabaseAccount* resource belonging to the source account being restored. This value is also given by the `ID` property of the restorable database account resource. An example of restorable account is */subscriptions/subscriptionId/providers/Microsoft.DocumentDB/locations/regionName/restorableDatabaseAccounts/\<guid-instanceid\>*| The subscription containing the restorable database account. |
59
-
|`Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read` </br> You can't choose resource group as the permission scope. |This permission is required on the source restorable database account scope to list the database accounts that can be restored. | The *RestorableDatabaseAccount* resource belonging to the source account being restored. This value is also given by the `ID` property of the restorable database account resource. An example of restorable account is */subscriptions/subscriptionId/providers/Microsoft.DocumentDB/locations/regionName/restorableDatabaseAccounts/\<guid-instanceid\>*| The subscription containing the restorable database account. |
60
-
|`Microsoft.DocumentDB/locations/restorableDatabaseAccounts/*/read` </br> You can't choose resource group as the permission scope. | This permission is required on the source restorable account scope to allow reading of restorable resources such as list of databases and containers for a restorable account. | The *RestorableDatabaseAccount* resource belonging to the source account being restored. This value is also given by the `ID` property of the restorable database account resource. An example of restorable account is */subscriptions/subscriptionId/providers/Microsoft.DocumentDB/locations/regionName/restorableDatabaseAccounts/\<guid-instanceid\>*| The subscription containing the restorable database account. |
49
+
> Assigning permissions at resource group scope is not supported.
50
+
51
+
|Permission |Impact |
52
+
|---------|---------|
53
+
|`Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restore/action` </br> You can't choose resource group as the permission scope. |This permission is required on the source restorable database account scope to allow restore actions to be performed on it. |
54
+
|`Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read` </br> You can't choose resource group as the permission scope. |This permission is required on the source restorable database account scope to list the database accounts that can be restored. |
55
+
|`Microsoft.DocumentDB/locations/restorableDatabaseAccounts/*/read` </br> You can't choose resource group as the permission scope. | This permission is required on the source restorable account scope to allow reading of restorable resources such as list of databases and containers for a restorable account. |
56
+
## Permissions on the destination account
57
+
58
+
Following permissions are required to perform the different activities pertaining to restore for continuous backup mode accounts:
59
+
60
+
61
+
|Permission |Impact |
62
+
|---------|---------|
63
+
|`Microsoft.Resources/deployments/validate/action`, `Microsoft.Resources/deployments/write` | These permissions are required for the ARM template deployment to create the restored account. See the sample permission [RestorableAction](#custom-restorable-action) below for how to set this role.
64
+
|`Microsoft.DocumentDB/databaseAccounts/write`| This permission is required to restore an account into a resource group |
65
+
61
66
62
67
## Azure CLI role assignment scenarios to restore at different scopes
@@ -62,7 +63,7 @@ The table below lists all the actions exposed by the permission model.
62
63
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create`| Create a new item. |
63
64
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read`| Read an individual item by its ID and partition key (point-read). |
64
65
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/replace`| Replace an existing item. |
65
-
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/upsert`| "Upsert" an item, which means create it if it doesn't exist, or replace it if it exists. |
66
+
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/upsert`| "Upsert" an item, which means to create or insert an item if it doesn't already exist, or to update or replace an item if it exists. |
66
67
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/delete`| Delete an item. |
67
68
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/executeQuery`| Execute a [SQL query](sql-query-getting-started.md). |
68
69
|`Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readChangeFeed`| Read from the container's [change feed](read-change-feed.md). |
@@ -96,7 +97,7 @@ The actual metadata requests allowed by the `Microsoft.DocumentDB/databaseAccoun
96
97
97
98
## Built-in role definitions
98
99
99
-
Azure Cosmos DB exposes 2 built-in role definitions:
100
+
Azure Cosmos DB exposes two built-in role definitions:
100
101
101
102
| ID | Name | Included actions |
102
103
|---|---|---|
@@ -342,9 +343,9 @@ See [this page](/rest/api/cosmos-db-resource-provider/2021-04-01-preview/sql-res
342
343
343
344
## Initialize the SDK with Azure AD
344
345
345
-
To use the Azure Cosmos DB RBAC in your application, you have to update the way you initialize the Azure Cosmos DB SDK. Instead of passing your account's primary key, you have to pass an instance of a `TokenCredential` class. This instance provides the Azure Cosmos DB SDK with the context required to fetch an AAD token on behalf of the identity you wish to use.
346
+
To use the Azure Cosmos DB RBAC in your application, you have to update the way you initialize the Azure Cosmos DB SDK. Instead of passing your account's primary key, you have to pass an instance of a `TokenCredential` class. This instance provides the Azure Cosmos DB SDK with the context required to fetch an Azure AD (AAD) token on behalf of the identity you wish to use.
346
347
347
-
The way you create a `TokenCredential` instance is beyond the scope of this article. There are many ways to create such an instance depending on the type of AAD identity you want to use (user principal, service principal, group etc.). Most importantly, your `TokenCredential` instance must resolve to the identity (principal ID) that you've assigned your roles to. You can find examples of creating a `TokenCredential` class:
348
+
The way you create a `TokenCredential` instance is beyond the scope of this article. There are many ways to create such an instance depending on the type of Azure AD identity you want to use (user principal, service principal, group etc.). Most importantly, your `TokenCredential` instance must resolve to the identity (principal ID) that you've assigned your roles to. You can find examples of creating a `TokenCredential` class:
@@ -414,18 +415,18 @@ When you access the [Azure Cosmos DB Explorer](https://cosmos.azure.com/?feature
414
415
415
416
## Audit data requests
416
417
417
-
When using the Azure Cosmos DB RBAC, [diagnostic logs](cosmosdb-monitor-resource-logs.md) get augmented with identity and authorization information for each data operation. This lets you perform detailed auditing and retrieve the AAD identity used for every data request sent to your Azure Cosmos DB account.
418
+
When using the Azure Cosmos DB RBAC, [diagnostic logs](cosmosdb-monitor-resource-logs.md) get augmented with identity and authorization information for each data operation. This lets you perform detailed auditing and retrieve the Azure AD identity used for every data request sent to your Azure Cosmos DB account.
418
419
419
420
This additional information flows in the **DataPlaneRequests** log category and consists of two extra columns:
420
421
421
-
-`aadPrincipalId_g` shows the principal ID of the AAD identity that was used to authenticate the request.
422
+
-`aadPrincipalId_g` shows the principal ID of the Azure AD identity that was used to authenticate the request.
422
423
-`aadAppliedRoleAssignmentId_g` shows the [role assignment](#role-assignments) that was honored when authorizing the request.
423
424
424
425
## <aid="disable-local-auth"></a> Enforcing RBAC as the only authentication method
425
426
426
427
In situations where you want to force clients to connect to Azure Cosmos DB through RBAC exclusively, you have the option to disable the account's primary/secondary keys. When doing so, any incoming request using either a primary/secondary key or a resource token will be actively rejected.
427
428
428
-
### Using Azure Resource Manager templates
429
+
### Use Azure Resource Manager templates
429
430
430
431
When creating or updating your Azure Cosmos DB account using Azure Resource Manager templates, set the `disableLocalAuth` property to `true`:
0 commit comments