Restorable Sql Databases - List

Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where database was accidentally deleted to get the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases?api-version=2024-08-15

URI Parameters

Name In Required Type Description
instanceId
path True

string

The instanceId GUID of a restorable database account.

location
path True

string

Cosmos DB region, with spaces between words and each word capitalized.

subscriptionId
path True

string

The ID of the target subscription.

api-version
query True

string

The API version to use for this operation.

Responses

Name Type Description
200 OK

RestorableSqlDatabasesListResult

The operation completed successfully.

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation Impersonate your user account

Examples

CosmosDBRestorableSqlDatabaseList

Sample request

GET https://management.azure.com/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlDatabases?api-version=2024-08-15

Sample response

{
  "value": [
    {
      "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/36f09704-6be3-4f33-aa05-17b73e504c75/restorableSqlDatabases/59c21367-b98b-4a8e-abb7-b6f46600decc",
      "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases",
      "name": "59c21367-b98b-4a8e-abb7-b6f46600decc",
      "properties": {
        "resource": {
          "_rid": "DLB14gAAAA==",
          "eventTimestamp": "2020-09-02T19:45:03Z",
          "ownerId": "Database1",
          "ownerResourceId": "3fu-hg==",
          "operationType": "Create",
          "canUndelete": "invalid",
          "database": {
            "id": "Database1",
            "_rid": "3fu-hg==",
            "_self": "dbs/3fu-hg==/",
            "_etag": "\"0000c20a-0000-0700-0000-5f4ff63f0000\"",
            "_colls": "colls/",
            "_users": "users/"
          }
        }
      }
    },
    {
      "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlDatabases/8456cb17-cdb0-4c6a-8db8-d0ff3f886257",
      "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases",
      "name": "8456cb17-cdb0-4c6a-8db8-d0ff3f886257",
      "properties": {
        "resource": {
          "_rid": "ESXNLAAAAA==",
          "eventTimestamp": "2020-09-02T19:53:42Z",
          "ownerId": "Database1",
          "ownerResourceId": "3fu-hg==",
          "database": {
            "id": "Database1",
            "_rid": "3fu-hg==",
            "_self": "dbs/3fu-hg==/",
            "_etag": "\"0000c20a-0000-0700-0000-5f4ff63f0000\"",
            "_colls": "colls/",
            "_users": "users/",
            "_ts": 1599075903
          },
          "operationType": "Delete",
          "canUndelete": "notRestorable",
          "canUndeleteReason": "Database already exists. Only deleted resources can be restored within same account."
        }
      }
    },
    {
      "id": "/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlDatabases/2c07991b-9c7c-4e85-be68-b18c1f2ff326",
      "type": "Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases",
      "name": "2c07991b-9c7c-4e85-be68-b18c1f2ff326",
      "properties": {
        "resource": {
          "_rid": "aXFqUQAAAA==",
          "eventTimestamp": "2020-09-02T19:53:15Z",
          "ownerId": "Database2",
          "ownerResourceId": "0SziSg==",
          "database": {
            "id": "Database2",
            "_rid": "0SziSg==",
            "_self": "dbs/0SziSg==/",
            "_etag": "\"0000ca0a-0000-0700-0000-5f4ff82b0000\"",
            "_colls": "colls/",
            "_users": "users/"
          },
          "operationType": "Create",
          "canUndelete": "invalid"
        }
      }
    }
  ]
}

Definitions

Name Description
CloudError

An error response from the service.

CreateMode

Enum to indicate the mode of account creation.

Database

Cosmos DB SQL database resource object

ErrorResponse

Error Response.

OperationType

Enum to indicate the operation type of the event.

Resource

The resource of an Azure Cosmos DB SQL database event

ResourceRestoreParameters

Parameters to indicate the information about the restore.

RestorableSqlDatabaseGetResult

An Azure Cosmos DB SQL database event

RestorableSqlDatabasesListResult

The List operation response, that contains the SQL database events and their properties.

CloudError

An error response from the service.

Name Type Description
error

ErrorResponse

Error Response.

CreateMode

Enum to indicate the mode of account creation.

Name Type Description
Default

string

Restore

string

Database

Cosmos DB SQL database resource object

Name Type Default value Description
_colls

string

A system generated property that specified the addressable path of the collections resource.

_etag

string

A system generated property representing the resource etag required for optimistic concurrency control.

_rid

string

A system generated property. A unique identifier.

_self

string

A system generated property that specifies the addressable path of the database resource.

_ts

number

A system generated property that denotes the last updated timestamp of the resource.

_users

string

A system generated property that specifies the addressable path of the users resource.

createMode

CreateMode

Default

Enum to indicate the mode of resource creation.

id

string

Name of the Cosmos DB SQL database

restoreParameters

ResourceRestoreParameters

Parameters to indicate the information about the restore

ErrorResponse

Error Response.

Name Type Description
code

string

Error code.

message

string

Error message indicating why the operation failed.

OperationType

Enum to indicate the operation type of the event.

Name Type Description
Create

string

Delete

string

Recreate

string

Replace

string

SystemOperation

string

Resource

The resource of an Azure Cosmos DB SQL database event

Name Type Description
_rid

string

A system generated property. A unique identifier.

canUndelete

string

A state of this database to identify if this database is restorable in same account.

canUndeleteReason

string

The reason why this database can not be restored in same account.

database

Database

Cosmos DB SQL database resource object

eventTimestamp

string

The time when this database event happened.

operationType

OperationType

The operation type of this database event.

ownerId

string

The name of the SQL database.

ownerResourceId

string

The resource ID of the SQL database.

ResourceRestoreParameters

Parameters to indicate the information about the restore.

Name Type Description
restoreSource

string

The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}

restoreTimestampInUtc

string

Time to which the account has to be restored (ISO-8601 format).

restoreWithTtlDisabled

boolean

Specifies whether the restored account will have Time-To-Live disabled upon the successful restore.

RestorableSqlDatabaseGetResult

An Azure Cosmos DB SQL database event

Name Type Description
id

string

The unique resource Identifier of the ARM resource.

name

string

The name of the ARM resource.

properties.resource

Resource

The resource of an Azure Cosmos DB SQL database event

type

string

The type of Azure resource.

RestorableSqlDatabasesListResult

The List operation response, that contains the SQL database events and their properties.

Name Type Description
value

RestorableSqlDatabaseGetResult[]

List of SQL database events and their properties.