steampipe plugin install azure

Table: azure_cosmosdb_mongo_database - Query Azure Cosmos DB MongoDB Databases using SQL

Azure Cosmos DB is a globally distributed, multi-model database service for managing data at planet-scale. It's built to power today's IoT and mobile apps, and tomorrow's AI-hungry future. The MongoDB API allows you to use Azure Cosmos DB as a fully managed NoSQL database to build modern and scalable applications.

Table Usage Guide

The azure_cosmosdb_mongo_database table provides detailed information about each MongoDB database within an Azure Cosmos DB account. As a database administrator or developer, you can use this table to gain insights into your MongoDB databases, including their properties, configuration settings, and associated metadata. This table is particularly useful for auditing, managing, and optimizing your Azure Cosmos DB MongoDB databases.

Examples

Basic info

Explore the performance and location details of your Azure Cosmos DB Mongo databases. This query can help you understand the maximum throughput settings and actual throughput, which can be useful for optimizing your database's performance and managing resources effectively.

select
name,
autoscale_settings_max_throughput,
throughput,
account_name,
region,
resource_group
from
azure_cosmosdb_mongo_database;
select
name,
autoscale_settings_max_throughput,
throughput,
account_name,
region,
resource_group
from
azure_cosmosdb_mongo_database;

Database count by cosmosdb account name

Determine the number of databases linked to each CosmosDB account in Azure. This is useful for understanding the distribution and organization of databases across different accounts in your Azure environment.

select
account_name,
count(name) as database_count
from
azure_cosmosdb_mongo_database
group by
account_name;
select
account_name,
count(name) as database_count
from
azure_cosmosdb_mongo_database
group by
account_name;

Get throughput settings for each database

Determine the areas in which throughput settings for each database in your Azure CosmosDB MongoDB can be optimized. This query can help in understanding the current configuration and identifying potential areas for performance improvement.

select
name,
account_name,
throughput_settings ->> 'Name' as name,
throughput_settings ->> 'ResourceThroughput' as throughput,
throughput_settings ->> 'AutoscaleSettingsMaxThroughput' as maximum_throughput,
throughput_settings ->> 'ResourceMinimumThroughput' as minimum_throughput,
throughput_settings ->> 'ID' as id
from
azure_cosmosdb_mongo_database;
select
name,
account_name,
json_extract(throughput_settings, '$.Name') as name,
json_extract(throughput_settings, '$.ResourceThroughput') as throughput,
json_extract(
throughput_settings,
'$.AutoscaleSettingsMaxThroughput'
) as maximum_throughput,
json_extract(
throughput_settings,
'$.ResourceMinimumThroughput'
) as minimum_throughput,
json_extract(throughput_settings, '$.ID') as id
from
azure_cosmosdb_mongo_database;

Schema for azure_cosmosdb_mongo_database

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_nametext=The friendly name that identifies the database account in which the database is created.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
autoscale_settings_max_throughputbigintContains maximum throughput, the resource can scale up to.
cloud_environmenttextThe Azure Cloud Environment.
database_etagtextA system generated property representing the resource etag required for optimistic concurrency control.
database_idtextName of the Cosmos DB MongoDB database.
database_ridtextA system generated unique identifier for database.
database_tsbigintA system generated property that denotes the last updated timestamp of the resource.
idtextContains ID to identify a Mongo DB database uniquely.
nametext=The friendly name that identifies the Mongo DB database.
regiontextThe Azure region/location in which the resource is located.
resource_grouptext=The resource group which holds this resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
subscription_idtext=, !=, ~~, ~~*, !~~, !~~*The Azure Subscription ID in which the resource is located.
tagsjsonbA map of tags for the resource.
throughputbigintContains the value of the Cosmos DB resource throughput or autoscaleSettings.
throughput_settingsjsonbContains the value of the Cosmos DB resource throughput or autoscaleSettings.
titletextTitle of the resource.
typetextType 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_mongo_database