Table: azure_cosmosdb_restorable_database_account - Query Azure Cosmos DB Restorable Database Accounts using SQL
Azure Cosmos DB is a fully managed NoSQL database service for modern app development. It offers turnkey global distribution, guarantees single-digit millisecond latencies at the 99th percentile, and guarantees high availability with multi-homing capabilities and low latencies anywhere in the world. A Restorable Database Account in Azure Cosmos DB is a resource that can be used to restore the account to a previous state.
Table Usage Guide
The azure_cosmosdb_restorable_database_account
table provides insights into restorable Azure Cosmos DB accounts within a specified time range. As a database administrator, explore account-specific details through this table, including the creation time, deletion time, and restorable time range. Utilize it to uncover information about accounts, such as those that are recently deleted, the time range within which the account can be restored, and the verification of restore locations.
Examples
Basic Info
Explore which Azure Cosmos DB accounts can be restored, pinpointing their specific locations and the time they were created. This is useful for assessing the elements within your resource group and planning for disaster recovery scenarios.
select name, region, account_name, creation_time, resource_groupfrom azure_cosmosdb_restorable_database_account;
select name, region, account_name, creation_time, resource_groupfrom azure_cosmosdb_restorable_database_account;
Get the regions that the database accounts can be restored from
Explore which regions your database accounts can be restored from, providing useful insights for disaster recovery planning and risk management. This allows you to identify potential fallback locations in case of regional outages or disruptions.
select name, region, restorable_locations ->> 'LocationName' as restorable_location, restorable_locations ->> 'CreationTime' as regional_database_account_creation_time, restorable_locations ->> 'RegionalDatabaseAccountInstanceID' as restorable_location_database_instance_idfrom azure_cosmosdb_restorable_database_account;
select name, region, json_extract(restorable_locations, '$.LocationName') as restorable_location, json_extract(restorable_locations, '$.CreationTime') as regional_database_account_creation_time, json_extract( restorable_locations, '$.RegionalDatabaseAccountInstanceID' ) as restorable_location_database_instance_idfrom azure_cosmosdb_restorable_database_account;
Get the accounts having point-in-time recovery enabled
Discover the Azure CosmosDB accounts that have point-in-time recovery enabled. This is useful for identifying accounts that may require additional backup strategies or have higher potential for data recovery in the event of data loss.
select ra.account_name, ra.name as restorable_database_account_name, creation_time, ra.id as restorable_database_account_idfrom azure_cosmosdb_restorable_database_account ra, azure_cosmosdb_account awhere ra.account_name = a.name and ra.subscription_id = a.subscription_id;
select ra.account_name, ra.name as restorable_database_account_name, creation_time, ra.id as restorable_database_account_idfrom azure_cosmosdb_restorable_database_account ra join azure_cosmosdb_account a on ra.account_name = a.name and ra.subscription_id = a.subscription_id;
Get the restorable account count per api type
Determine the number of restorable accounts for each API type to manage and optimize your Azure Cosmos DB resources. This can be useful for understanding your capacity and planning for potential disaster recovery scenarios.
select api_type, count(ra.*) as accountsfrom azure_cosmosdb_restorable_database_account ragroup by api_type;
select api_type, count(*) as accountsfrom azure_cosmosdb_restorable_database_account ragroup by api_type;
Query examples
Schema for azure_cosmosdb_restorable_database_account
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_name | text | The name of the global database account. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
api_type | text | The API type of the restorable database account. | |
cloud_environment | text | The Azure Cloud Environment. | |
creation_time | timestamp with time zone | The creation time of the restorable database account. | |
deletion_time | timestamp with time zone | The time at which the restorable database account has been deleted. | |
id | text | Contains ID to identify a restorable database account uniquely. | |
name | text | The friendly name that identifies the restorable database account. | |
region | text | The Azure region/location in which the resource is located. | |
resource_group | text | The resource group which holds this resource. | |
restorable_locations | jsonb | List of regions where the database account can be restored from. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
subscription_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Azure Subscription ID in which the resource is located. |
title | text | Title of the resource. | |
type | text | Type of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- azure
You can pass the configuration to the command with the --config
argument:
steampipe_export_azure --config '<your_config>' azure_cosmosdb_restorable_database_account