Open neil-yechenwei opened 2 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pjohari-ms, @MehaKaushik, @zfoster, @kushagraThapar, @simorenoh, @simplynaveen20, @abinav2307.
Author: | neil-yechenwei |
---|---|
Assignees: | - |
Labels: | `Cosmos`, `Service Attention`, `needs-triage` |
Milestone: | - |
Actually there's an API for this, the same used by Azure Portal, in preview, but exists:
Adding a reference to the preview version would be really great, the information I've collected was after inspecting the calls done by Azure Portal, tested replaying them and worked as expected.
E.g.:
PATCH https://management.azure.com/subscriptions/<subscriptionId>/resourceGroups/<resource-group-name>/providers/Microsoft.DocumentDB/databaseAccounts/<cosmosdb-account-name>/?api-version=2022-08-15-preview
Content-Type: application/json
DNT: 1
x-ms-command-name: Microsoft_Azure_DocumentDB.
Authorization: Bearer <access token>
{
"properties": {
"backupPolicy": {
"type": "Continuous",
"continuousModeProperties": {
"tier": "Continuous7Days"
}
}
}
}
or for 30 days:
PATCH https://management.azure.com/subscriptions/<subscriptionId>/resourceGroups/<resource-group-name>/providers/Microsoft.DocumentDB/databaseAccounts/<cosmosdb-account-name>/?api-version=2022-08-15-preview
Content-Type: application/json
DNT: 1
x-ms-command-name: Microsoft_Azure_DocumentDB.
Authorization: Bearer <access token>
{
"properties": {
"backupPolicy": {
"type": "Continuous",
"continuousModeProperties": {
"tier": "Continuous30Days"
}
}
}
}
The response is resource defintion in JSON:
HTTP/1.1 200 Ok
Cache-Control: no-store, no-cache
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: application/json
Content-Encoding: gzip
Location: https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxxxx/providers/Microsoft.DocumentDB/databaseAccounts/xxxxxxxxxxx/operationResults/59e4aee3-e9f1-4501-97e7-6112c0f1a77e?api-version=2022-08-15-preview
Vary: Accept-Encoding
x-ms-request-id: xxxxxxxxxxxxxxxxxxx
Azure-AsyncOperation: https://management.azure.com/subscriptions/xxxxxxxxxxxxxx/providers/Microsoft.DocumentDB/locations/uksouth/operationsStatus/xxxxxxxxxxxx?api-version=2022-08-15-preview
Strict-Transport-Security: max-age=31536000; includeSubDomains
x-ms-gatewayversion: version=2.14.0
Server: Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id: xxxxxxxxxxxxxxxxxx
x-ms-routing-request-id: xxxxxxxxxxxxxxxxxxxxxxxxxxx
X-Content-Type-Options: nosniff
Date: Tue, 27 Sep 2022 15:58:22 GMT
Connection: close
{
"id": "/subscriptions/xxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxxx/providers/Microsoft.DocumentDB/databaseAccounts/xxxxxxxxxxxxxxxx",
"name": "xxxxxxxxxxxx",
"location": "UK South",
"type": "Microsoft.DocumentDB/databaseAccounts",
"kind": "GlobalDocumentDB",
"tags": {
"hidden-cosmos-mmspecial": ""
},
"systemData": {
"createdAt": "2022-06-28T15:12:31.8295795Z"
},
"properties": {
"provisioningState": "Updating",
"documentEndpoint": "[https://xxxxxxxxx.documents.azure.com:443/](https://xxxxxxxxxxxxxxx.documents.azure.com/)",
"publicNetworkAccess": "Enabled",
"enableAutomaticFailover": true,
"enableMultipleWriteLocations": false,
"enablePartitionKeyMonitor": true,
"isVirtualNetworkFilterEnabled": true,
"virtualNetworkRules": [
{
"id": "/subscriptions/xxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxx/providers/Microsoft.Network/virtualNetworks/xxxxxxxxxxxxxxx/subnets/xxxxxxxxxxxxx",
"ignoreMissingVNetServiceEndpoint": false
},
{
"id": "/subscriptions/xxxxxxxxxxx/resourceGroups/xxxxxxxxxx/providers/Microsoft.Network/virtualNetworks/xxxxxxxxxxxxxxxxx/subnets/xxxxxxxxxxxxxx",
"ignoreMissingVNetServiceEndpoint": false
}
],
"EnabledApiTypes": "Sql",
"disableKeyBasedMetadataWriteAccess": false,
"enableFreeTier": false,
"enableAnalyticalStorage": false,
"analyticalStorageConfiguration": {
"schemaType": "WellDefined"
},
"instanceId": "xxxxxxxxxxxxxxxxxxxxxxxx",
"createMode": "Default",
"databaseAccountOfferType": "Standard",
"defaultIdentity": "FirstPartyIdentity",
"networkAclBypass": "None",
"disableLocalAuth": false,
"enablePartitionMerge": false,
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
"maxStalenessPrefix": 100
},
"configurationOverrides": {},
"writeLocations": [
{
"id": "xxxxxxxxxxxx",
"locationName": "UK South",
"documentEndpoint": "[https://xxxxxxxxx.documents.azure.com:443/](xxxxxxxxxxxxxxxxxxxx.documents.azure.com/)",
"provisioningState": "Succeeded",
"failoverPriority": 0,
"isZoneRedundant": false
}
],
"readLocations": [
{
"id": "xxxxxxxxxxxxxxxxxxx",
"locationName": "UK South",
"documentEndpoint": "[https://xxxxxxxxxxxxxx.documents.azure.com:443/](https://xxxxxxxxxxxxxx.documents.azure.com/)",
"provisioningState": "Succeeded",
"failoverPriority": 0,
"isZoneRedundant": false
},
{
"id": "xxxxxxxxxxxxxxxxxxx",
"locationName": "UK West",
"documentEndpoint": "[https://xxxxxxxxxxxxxxxxxx.documents.azure.com:443/](https://xxxxxxxxxxxxxxxxx.documents.azure.com/)",
"provisioningState": "Succeeded",
"failoverPriority": 1,
"isZoneRedundant": false
}
],
"locations": [
{
"id": "xxxxxxxxxxxxxxxxxxxxxx",
"locationName": "UK South",
"documentEndpoint": "[https://xxxxxxxxxxxxxx.documents.azure.com:443/](https://xxxxxxxxxxxxxx.documents.azure.com/)",
"provisioningState": "Succeeded",
"failoverPriority": 0,
"isZoneRedundant": false
},
{
"id": "xxxxxxxxxxxxxxxxxx",
"locationName": "UK West",
"documentEndpoint": "[https://xxxxxxxxxxxxxx.documents.azure.com:443/](https://xxxxxxxxxxxxxx.documents.azure.com/)",
"provisioningState": "Succeeded",
"failoverPriority": 1,
"isZoneRedundant": false
}
],
"failoverPolicies": [
{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"locationName": "UK South",
"failoverPriority": 0
},
{
"id": "xxxxxxxxxxxxxx",
"locationName": "UK West",
"failoverPriority": 1
}
],
"cors": [],
"capabilities": [],
"ipRules": [],
"backupPolicy": {
"type": "Continuous",
"continuousModeProperties": {
"tier": "Continuous30Days"
}
},
"networkAclBypassResourceIds": [],
"diagnosticLogSettings": {
"enableFullTextQuery": "None"
},
"capacity": {
"totalThroughputLimit": 4000
},
"keysMetadata": {
"primaryMasterKey": {
"generationTime": "2022-06-28T15:12:31.8295795Z"
},
"secondaryMasterKey": {
"generationTime": "2022-06-28T15:12:31.8295795Z"
},
"primaryReadonlyMasterKey": {
"generationTime": "2022-06-28T15:12:31.8295795Z"
},
"secondaryReadonlyMasterKey": {
"generationTime": "2022-06-28T15:12:31.8295795Z"
}
}
},
"identity": {
"type": "None"
}
}
So please kindly speed up this :)
I've came up with a workaround based in a null_resource with a trigger against a variable that holds the backup retention period 7/30 and will run a shell script that will make the call above, as long backup mode is continuous.
Am I right in thinking this is present now, in 2023-04-15?
If so this could possibly be closed, and it unblocks https://github.com/hashicorp/terraform-provider-azurerm/issues/17997
The Azure Doc indicates CosmosDB Account supports Continuous 7-day tier. But after checked azure rest api spec, seems it doesn't support this feature. If it's expected feature, does it make sense to add this feature in azure rest api spec? Thanks.