Skip to content

Commit 947af12

Browse files
Merge pull request #227846 from kanshiG/patch-119
Update continuous-backup-restore-permissions.md
2 parents 5bc3db4 + 9e40631 commit 947af12

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

articles/cosmos-db/continuous-backup-restore-permissions.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to isolate and restrict the restore permissions for conti
44
author: kanshiG
55
ms.service: cosmos-db
66
ms.topic: how-to
7-
ms.date: 02/28/2022
7+
ms.date: 02/17/2023
88
ms.author: govindk
99
ms.reviewer: mjbrown
1010
ms.custom: subject-rbac-steps, ignite-2022
@@ -13,7 +13,7 @@ ms.custom: subject-rbac-steps, ignite-2022
1313
# Manage permissions to restore an Azure Cosmos DB account
1414
[!INCLUDE[NoSQL, MongoDB, Gremlin, Table](includes/appliesto-nosql-mongodb-gremlin-table.md)]
1515

16-
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+
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:
1717

1818
:::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":::
1919

@@ -47,19 +47,26 @@ To perform a restore, a user or a principal need the permission to restore (that
4747
|---------|---------|
4848
|Subscription | /subscriptions/00000000-0000-0000-0000-000000000000 |
4949
|Resource group | /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/Example-cosmosdb-rg |
50+
|CosmosDB restorable account resource | /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/locations/West US/restorableDatabaseAccounts/23e99a35-cd36-4df4-9614-f767a03b9995|
51+
52+
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.
5053

5154

5255
## Permissions on the source account
5356
Following permissions are required to perform the different activities pertaining to restore for continuous backup mode accounts:
5457

55-
> [!NOTE]
56-
> Assigning permissions at resource group scope is not supported.
5758

58-
|Permission |Impact |
59-
|---------|---------|
60-
|`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. |
61-
|`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. |
62-
|`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. |
59+
> [!NOTE]
60+
> Permission can be assigned to restorable database account at account scope or subscription scope. Assigning permissions at resource group scope is not supported.
61+
62+
|Permission |Impact |Minimum scope |Maximum scope |
63+
|---------|---------|---------|---------|
64+
|`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 |
65+
|`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 |
66+
|`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. |
67+
|`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. |
68+
|`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. |
69+
6370
## Permissions on the destination account
6471

6572
Following permissions are required to perform the different activities pertaining to restore for continuous backup mode accounts:
@@ -76,6 +83,8 @@ Following permissions are required to perform the different activities pertainin
7683
Roles with permission can be assigned to different scopes to achieve granular control on who can perform the restore operation within a subscription or a given account.
7784

7885
### Assign capability to restore from any restorable account in a subscription
86+
- Assign a user write action on the specific resource group. This action is required to create a new account in the resource group.
87+
- Assign the `CosmosRestoreOperator` built in role to the specific restorable database account that needs to be restored. In the following command, the scope for the `RestorableDatabaseAccount` is extracted from the `ID` property of result of execution of `az cosmosdb restorable-database-account list`(if using CLI) or `Get-AzCosmosDBRestorableDatabaseAccount`(if using the PowerShell)
7988

8089
Assign the `CosmosRestoreOperator` built-in role at subscription level
8190

articles/cosmos-db/nosql/how-to-write-stored-procedures-triggers-udfs.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ To call a stored procedure, trigger, and user-defined function, you need to regi
3131
## <a id="stored-procedures"></a>How to write stored procedures
3232

3333
Stored procedures are written using JavaScript, they can create, update, read, query, and delete items inside an Azure Cosmos DB container. Stored procedures are registered per collection, and can operate on any document or an attachment present in that collection.
34-
34+
> [Note]
35+
> When it comes to stored procedure, Cosmos DB has different charging policy. Since, stored can essentially execute code and consume any number of RUs, we do upfront charging for each stored procedure execution. This is a defense mechanism in backend to ensure stored procedure scripts do not impact out backend services. The amount which is charged upfront is the average charge consumed by the script in previous invocations. If the stored procedure has varied RUs per invocation i.e., lot of variance around the mean then the client may not be able to fully utilize the budget as we always reserve the average RU per operations before we start the execution. As an alternative we would suggest the client to use batch or bulk requests instead of stored procedures to avoid the variance around the RU charging.
36+
>
3537
Here is a simple stored procedure that returns a "Hello World" response.
3638

3739
```javascript

0 commit comments

Comments
 (0)