Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/dataprotection/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
1.11.0
++++++
* Added dataprotection support for AzureCosmosDB workload: new manifest (Microsoft.DocumentDB/databaseAccounts), registration in supported datasource types, datasource map, and permission help text. Added end-to-end backup/restore scenario test, unit tests for default policy template, backup-instance initialize, and restore initialize, and an update-msi-permissions live test that grants Reader/Cosmos DB Operator on the data source RG / account.

1.10.0
++++++
* Bumped API version to 2026-03-01 for backup-instance create, update, validate-for-backup, and validate-for-update commands.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

manifest = '''
{
"isProxyResource": false,
"enableDataSourceSetInfo": false,
"resourceType": "Microsoft.DocumentDB/databaseAccounts",
"parentResourceType": "Microsoft.DocumentDB/databaseAccounts",
"datasourceType": "Microsoft.DocumentDB/databaseAccounts",
"allowedRestoreModes": [ "RecoveryPointBased" ],
"allowedRestoreTargetTypes": [ "AlternateLocation" ],
"itemLevelRecoveryEnabled": false,
"addBackupDatasourceParametersList": false,
"backupConfigurationRequired": false,
"addDataStoreParametersList": false,
"friendlyNameRequired": false,
"supportSecretStoreAuthentication": false,
"backupVaultPermissions": [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: have we tested if the update-msi-permissions command works as expected with this set of permissions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[update-msi-permissions] worked end-to-end and the permissions it set were exactly sufficient to complete configure-protection, adhoc-backup, and AlternateLocation restore

{
"roleDefinitionName": "Reader",
"type": "DataSourceRG"
},
{
"roleDefinitionName": "Cosmos DB Operator",
"type": "DataSource"
}
],
"backupVaultRestorePermissions": [
{
"roleDefinitionName": "Cosmos DB Operator",
"type": "DataSource"
}
],
"policySettings": {
"supportedRetentionTags": [ "Weekly", "Monthly", "Yearly" ],
"supportedDatastoreTypes": [ "VaultStore" ],
"disableAddRetentionRule": false,
"disableCustomRetentionTag": false,
"backupScheduleSupported": true,
"supportedBackupFrequency": [ "Weekly" ],
"defaultPolicy": {
"policyRules": [
{
"name": "BackupWeekly",
"objectType": "AzureBackupRule",
"backupParameters": {
"backupType": "full",
"objectType": "AzureBackupParams"
},
"dataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
},
"trigger": {
"schedule": {
"timeZone": "UTC",
"repeatingTimeIntervals": [ "R/2026-02-08T10:00:00+00:00/P1W" ]
},
"taggingCriteria": [
{
"isDefault": true,
"taggingPriority": 99,
"tagInfo": {
"id": "Default_",
"tagName": "Default"
}
}
],
"objectType": "ScheduleBasedTriggerContext"
}
},
{
"name": "Default",
"objectType": "AzureRetentionRule",
"isDefault": true,
"lifecycles": [
{
"deleteAfter": {
"duration": "P10Y",
"objectType": "AbsoluteDeleteOption"
},
"sourceDataStore": {
"dataStoreType": "VaultStore",
"objectType": "DataStoreInfoBase"
},
"targetDataStoreCopySettings": []
}
]
}
],
"datasourceTypes": [ "Microsoft.DocumentDB/databaseAccounts" ],
"objectType": "BackupPolicy",
"name": "CosmosDBPolicy1"
}
}
}'''
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

supported_datasource_types = ["AzureDisk", "AzureBlob", "AzureDataLakeStorage",
"AzureDatabaseForPostgreSQL", "AzureKubernetesService",
"AzureDatabaseForPostgreSQLFlexibleServer", "AzureDatabaseForMySQL"]
"AzureDatabaseForPostgreSQLFlexibleServer", "AzureDatabaseForMySQL",
"AzureCosmosDB"]
12 changes: 11 additions & 1 deletion src/dataprotection/azext_dataprotection/manual/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"AzureDatabaseForPostgreSQL": "Microsoft.DBforPostgreSQL/servers/databases",
"AzureKubernetesService": "Microsoft.ContainerService/managedClusters",
"AzureDatabaseForPostgreSQLFlexibleServer": "Microsoft.DBforPostgreSQL/flexibleServers",
"AzureDatabaseForMySQL": "Microsoft.DBforMySQL/flexibleServers"
"AzureDatabaseForMySQL": "Microsoft.DBforMySQL/flexibleServers",
"AzureCosmosDB": "Microsoft.DocumentDB/databaseAccounts"
}

# This is ideally temporary, as Backup Vault contains secondary region information. But in some cases
Expand Down Expand Up @@ -950,6 +951,8 @@ def get_help_word_from_permission_type(permission_type, datasource_type):
helptext_dsname = "Postgres flexible server"
if datasource_type == 'AzureDatabaseForMySQL':
helptext_dsname = "MySQL server"
if datasource_type == 'AzureCosmosDB':
helptext_dsname = "Cosmos DB account"

return helptext_dsname

Expand Down Expand Up @@ -1056,7 +1059,14 @@ def convert_dict_keys_snake_to_camel(dictionary):
return new_dictionary


_SNAKE_TO_CAMEL_OVERRIDES = {
"resource_id": "resourceID",
}


def convert_string_snake_to_camel(string):
if string in _SNAKE_TO_CAMEL_OVERRIDES:
return _SNAKE_TO_CAMEL_OVERRIDES[string]
new_string = re.sub(r'_([a-z])', lambda m: m.group(1).upper(), string)
return new_string

Expand Down
Loading
Loading