database_accounts
Creates, updates, deletes, gets or lists a database_accounts resource.
Overview
| Name | database_accounts |
| Type | Resource |
| Id | azure.cosmosdb.database_accounts |
Fields
The following fields are returned by SELECT queries:
- list_metrics
- get
- list_by_resource_group
- list
| Name | Datatype | Description |
|---|---|---|
name | object | The name information for the metric. |
endTime | string (date-time) | The end time for the metric (ISO-8601 format). |
metricValues | array | The metric values for the specified time window and timestep. |
startTime | string (date-time) | The start time for the metric (ISO-8601 format). |
timeGrain | string | The time grain to be used to summarize the metric values. |
unit | string | The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", "BytesPerSecond", and "Milliseconds". (Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond, Milliseconds) |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
analyticalStorageConfiguration | object | Analytical storage specific properties. |
apiProperties | object | API specific properties. |
backupPolicy | object | The object representing the policy for taking backups on an account. |
capabilities | array | List of Cosmos DB capabilities for the account. |
capacity | object | The object that represents all properties related to capacity enforcement on an account. |
connectorOffer | string | The cassandra connector offer type for the Cosmos DB database C* account. "Small" (Small) |
consistencyPolicy | object | The consistency policy for the Cosmos DB database account. |
cors | array | The CORS policy for the Cosmos DB database account. |
createMode | string | Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". (Default, Restore) |
customerManagedKeyStatus | string | Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. |
databaseAccountOfferType | string | The offer type for the Cosmos DB database account. Default value: Standard. Default value is "Standard". |
defaultIdentity | string | The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. |
defaultPriorityLevel | string | Enum to indicate default Priority Level of request for Priority Based Execution. Known values are: "High" and "Low". (High, Low) |
disableKeyBasedMetadataWriteAccess | boolean | Disable write operations on metadata resources (databases, containers, throughput) via account keys. |
disableLocalAuth | boolean | Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. |
documentEndpoint | string | The connection endpoint for the Cosmos DB database account. |
enableAnalyticalStorage | boolean | Flag to indicate whether to enable storage analytics. |
enableAutomaticFailover | boolean | Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. |
enableBurstCapacity | boolean | Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. |
enableCassandraConnector | boolean | Enables the cassandra connector on the Cosmos DB C* account. |
enableFreeTier | boolean | Flag to indicate whether Free Tier is enabled. |
enableMultipleWriteLocations | boolean | Enables the account to write in multiple locations. |
enablePartitionMerge | boolean | Flag to indicate enabling/disabling of Partition Merge feature on the account. |
enablePerRegionPerPartitionAutoscale | boolean | Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account. |
enablePriorityBasedExecution | boolean | Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. |
enforceHierarchicalPartitionKeyIdLastLevel | boolean | Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account. |
failoverPolicies | array | An array that contains the regions ordered by their failover priorities. |
identity | object | Identity for the resource. |
instanceId | string | A unique identifier assigned to the database account. |
ipRules | array | List of IpRules. |
isVirtualNetworkFilterEnabled | boolean | Flag to indicate whether to enable/disable Virtual Network ACL rules. |
keyVaultKeyUri | string | The URI of the key vault. |
keyVaultKeyUriVersion | string | The version of the Customer Managed Key currently being used by the account. |
keysMetadata | object | The object that represents the metadata for the Account Keys of the Cosmos DB account. |
kind | string | Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". (GlobalDocumentDB, MongoDB, Parse) |
location | string | The location of the resource group to which the resource belongs. |
locations | array | An array that contains all of the locations enabled for the Cosmos DB account. |
minimalTlsVersion | string | Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", "Tls11", and "Tls12". (Tls, Tls11, Tls12) |
networkAclBypass | string | Indicates what services are allowed to bypass firewall checks. Known values are: "None" and "AzureServices". (None, AzureServices) |
networkAclBypassResourceIds | array | An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. |
privateEndpointConnections | array | List of Private Endpoint Connections configured for the Cosmos DB account. |
provisioningState | string | The provisioning state of the resource. |
publicNetworkAccess | string | Whether requests from Public Network are allowed. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". (Enabled, Disabled, SecuredByPerimeter) |
readLocations | array | An array that contains of the read locations enabled for the Cosmos DB account. |
restoreParameters | object | Parameters to indicate the information about the restore. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
virtualNetworkRules | array | List of Virtual Network ACL rules configured for the Cosmos DB account. |
writeLocations | array | An array that contains the write location for the Cosmos DB account. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
analyticalStorageConfiguration | object | Analytical storage specific properties. |
apiProperties | object | API specific properties. |
backupPolicy | object | The object representing the policy for taking backups on an account. |
capabilities | array | List of Cosmos DB capabilities for the account. |
capacity | object | The object that represents all properties related to capacity enforcement on an account. |
connectorOffer | string | The cassandra connector offer type for the Cosmos DB database C* account. "Small" (Small) |
consistencyPolicy | object | The consistency policy for the Cosmos DB database account. |
cors | array | The CORS policy for the Cosmos DB database account. |
createMode | string | Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". (Default, Restore) |
customerManagedKeyStatus | string | Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. |
databaseAccountOfferType | string | The offer type for the Cosmos DB database account. Default value: Standard. Default value is "Standard". |
defaultIdentity | string | The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. |
defaultPriorityLevel | string | Enum to indicate default Priority Level of request for Priority Based Execution. Known values are: "High" and "Low". (High, Low) |
disableKeyBasedMetadataWriteAccess | boolean | Disable write operations on metadata resources (databases, containers, throughput) via account keys. |
disableLocalAuth | boolean | Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. |
documentEndpoint | string | The connection endpoint for the Cosmos DB database account. |
enableAnalyticalStorage | boolean | Flag to indicate whether to enable storage analytics. |
enableAutomaticFailover | boolean | Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. |
enableBurstCapacity | boolean | Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. |
enableCassandraConnector | boolean | Enables the cassandra connector on the Cosmos DB C* account. |
enableFreeTier | boolean | Flag to indicate whether Free Tier is enabled. |
enableMultipleWriteLocations | boolean | Enables the account to write in multiple locations. |
enablePartitionMerge | boolean | Flag to indicate enabling/disabling of Partition Merge feature on the account. |
enablePerRegionPerPartitionAutoscale | boolean | Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account. |
enablePriorityBasedExecution | boolean | Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. |
enforceHierarchicalPartitionKeyIdLastLevel | boolean | Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account. |
failoverPolicies | array | An array that contains the regions ordered by their failover priorities. |
identity | object | Identity for the resource. |
instanceId | string | A unique identifier assigned to the database account. |
ipRules | array | List of IpRules. |
isVirtualNetworkFilterEnabled | boolean | Flag to indicate whether to enable/disable Virtual Network ACL rules. |
keyVaultKeyUri | string | The URI of the key vault. |
keyVaultKeyUriVersion | string | The version of the Customer Managed Key currently being used by the account. |
keysMetadata | object | The object that represents the metadata for the Account Keys of the Cosmos DB account. |
kind | string | Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". (GlobalDocumentDB, MongoDB, Parse) |
location | string | The location of the resource group to which the resource belongs. |
locations | array | An array that contains all of the locations enabled for the Cosmos DB account. |
minimalTlsVersion | string | Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", "Tls11", and "Tls12". (Tls, Tls11, Tls12) |
networkAclBypass | string | Indicates what services are allowed to bypass firewall checks. Known values are: "None" and "AzureServices". (None, AzureServices) |
networkAclBypassResourceIds | array | An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. |
privateEndpointConnections | array | List of Private Endpoint Connections configured for the Cosmos DB account. |
provisioningState | string | The provisioning state of the resource. |
publicNetworkAccess | string | Whether requests from Public Network are allowed. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". (Enabled, Disabled, SecuredByPerimeter) |
readLocations | array | An array that contains of the read locations enabled for the Cosmos DB account. |
restoreParameters | object | Parameters to indicate the information about the restore. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
virtualNetworkRules | array | List of Virtual Network ACL rules configured for the Cosmos DB account. |
writeLocations | array | An array that contains the write location for the Cosmos DB account. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
analyticalStorageConfiguration | object | Analytical storage specific properties. |
apiProperties | object | API specific properties. |
backupPolicy | object | The object representing the policy for taking backups on an account. |
capabilities | array | List of Cosmos DB capabilities for the account. |
capacity | object | The object that represents all properties related to capacity enforcement on an account. |
connectorOffer | string | The cassandra connector offer type for the Cosmos DB database C* account. "Small" (Small) |
consistencyPolicy | object | The consistency policy for the Cosmos DB database account. |
cors | array | The CORS policy for the Cosmos DB database account. |
createMode | string | Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". (Default, Restore) |
customerManagedKeyStatus | string | Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. |
databaseAccountOfferType | string | The offer type for the Cosmos DB database account. Default value: Standard. Default value is "Standard". |
defaultIdentity | string | The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. |
defaultPriorityLevel | string | Enum to indicate default Priority Level of request for Priority Based Execution. Known values are: "High" and "Low". (High, Low) |
disableKeyBasedMetadataWriteAccess | boolean | Disable write operations on metadata resources (databases, containers, throughput) via account keys. |
disableLocalAuth | boolean | Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication. |
documentEndpoint | string | The connection endpoint for the Cosmos DB database account. |
enableAnalyticalStorage | boolean | Flag to indicate whether to enable storage analytics. |
enableAutomaticFailover | boolean | Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. |
enableBurstCapacity | boolean | Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account. |
enableCassandraConnector | boolean | Enables the cassandra connector on the Cosmos DB C* account. |
enableFreeTier | boolean | Flag to indicate whether Free Tier is enabled. |
enableMultipleWriteLocations | boolean | Enables the account to write in multiple locations. |
enablePartitionMerge | boolean | Flag to indicate enabling/disabling of Partition Merge feature on the account. |
enablePerRegionPerPartitionAutoscale | boolean | Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account. |
enablePriorityBasedExecution | boolean | Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account. |
enforceHierarchicalPartitionKeyIdLastLevel | boolean | Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account. |
failoverPolicies | array | An array that contains the regions ordered by their failover priorities. |
identity | object | Identity for the resource. |
instanceId | string | A unique identifier assigned to the database account. |
ipRules | array | List of IpRules. |
isVirtualNetworkFilterEnabled | boolean | Flag to indicate whether to enable/disable Virtual Network ACL rules. |
keyVaultKeyUri | string | The URI of the key vault. |
keyVaultKeyUriVersion | string | The version of the Customer Managed Key currently being used by the account. |
keysMetadata | object | The object that represents the metadata for the Account Keys of the Cosmos DB account. |
kind | string | Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". (GlobalDocumentDB, MongoDB, Parse) |
location | string | The location of the resource group to which the resource belongs. |
locations | array | An array that contains all of the locations enabled for the Cosmos DB account. |
minimalTlsVersion | string | Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", "Tls11", and "Tls12". (Tls, Tls11, Tls12) |
networkAclBypass | string | Indicates what services are allowed to bypass firewall checks. Known values are: "None" and "AzureServices". (None, AzureServices) |
networkAclBypassResourceIds | array | An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. |
privateEndpointConnections | array | List of Private Endpoint Connections configured for the Cosmos DB account. |
provisioningState | string | The provisioning state of the resource. |
publicNetworkAccess | string | Whether requests from Public Network are allowed. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". (Enabled, Disabled, SecuredByPerimeter) |
readLocations | array | An array that contains of the read locations enabled for the Cosmos DB account. |
restoreParameters | object | Parameters to indicate the information about the restore. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
virtualNetworkRules | array | List of Virtual Network ACL rules configured for the Cosmos DB account. |
writeLocations | array | An array that contains the write location for the Cosmos DB account. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_metrics | select | resource_group_name, account_name, subscription_id, $filter | Retrieves the metrics determined by the given filter for the given database account. | |
get | select | resource_group_name, account_name, subscription_id | Retrieves the properties of an existing Azure Cosmos DB database account. | |
list_by_resource_group | select | resource_group_name, subscription_id | Lists all the Azure Cosmos DB database accounts available under the given resource group. | |
list | select | subscription_id | Lists all the Azure Cosmos DB database accounts available under the subscription. | |
create_or_update | insert | resource_group_name, account_name, subscription_id, properties | Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. | |
update | update | resource_group_name, account_name, subscription_id | Updates the properties of an existing Azure Cosmos DB database account. | |
create_or_update | replace | resource_group_name, account_name, subscription_id, properties | Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account. | |
delete | delete | resource_group_name, account_name, subscription_id | Deletes an existing Azure Cosmos DB database account. | |
list_keys | exec | resource_group_name, account_name, subscription_id | Lists the access keys for the specified Azure Cosmos DB database account. | |
list_connection_strings | exec | resource_group_name, account_name, subscription_id | Lists the connection strings for the specified Azure Cosmos DB database account. | |
list_read_only_keys | exec | resource_group_name, account_name, subscription_id | Lists the read-only access keys for the specified Azure Cosmos DB database account. | |
get_read_only_keys | exec | resource_group_name, account_name, subscription_id | Lists the read-only access keys for the specified Azure Cosmos DB database account. | |
list_usages | exec | resource_group_name, account_name, subscription_id | $filter | Retrieves the usages (most recent data) for the given database account. |
list_metric_definitions | exec | resource_group_name, account_name, subscription_id | Retrieves metric definitions for the given database account. | |
failover_priority_change | exec | resource_group_name, account_name, subscription_id, failoverPolicies | Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. | |
offline_region | exec | resource_group_name, account_name, subscription_id, region | Offline the specified region for the specified Azure Cosmos DB database account. | |
online_region | exec | resource_group_name, account_name, subscription_id, region | Online the specified region for the specified Azure Cosmos DB database account. | |
regenerate_key | exec | resource_group_name, account_name, subscription_id, keyKind | Regenerates an access key for the specified Azure Cosmos DB database account. | |
check_name_exists | exec | account_name | Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
$filter | string | An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. Required. |
account_name | string | Cosmos DB database account name. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
subscription_id | string | |
$filter | string | An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). Default value is None. |
SELECT examples
- list_metrics
- get
- list_by_resource_group
- list
Retrieves the metrics determined by the given filter for the given database account.
SELECT
name,
endTime,
metricValues,
startTime,
timeGrain,
unit
FROM azure.cosmosdb.database_accounts
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND account_name = '{{ account_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}' -- required
;
Retrieves the properties of an existing Azure Cosmos DB database account.
SELECT
id,
name,
analyticalStorageConfiguration,
apiProperties,
backupPolicy,
capabilities,
capacity,
connectorOffer,
consistencyPolicy,
cors,
createMode,
customerManagedKeyStatus,
databaseAccountOfferType,
defaultIdentity,
defaultPriorityLevel,
disableKeyBasedMetadataWriteAccess,
disableLocalAuth,
documentEndpoint,
enableAnalyticalStorage,
enableAutomaticFailover,
enableBurstCapacity,
enableCassandraConnector,
enableFreeTier,
enableMultipleWriteLocations,
enablePartitionMerge,
enablePerRegionPerPartitionAutoscale,
enablePriorityBasedExecution,
enforceHierarchicalPartitionKeyIdLastLevel,
failoverPolicies,
identity,
instanceId,
ipRules,
isVirtualNetworkFilterEnabled,
keyVaultKeyUri,
keyVaultKeyUriVersion,
keysMetadata,
kind,
location,
locations,
minimalTlsVersion,
networkAclBypass,
networkAclBypassResourceIds,
privateEndpointConnections,
provisioningState,
publicNetworkAccess,
readLocations,
restoreParameters,
systemData,
tags,
type,
virtualNetworkRules,
writeLocations
FROM azure.cosmosdb.database_accounts
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND account_name = '{{ account_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Lists all the Azure Cosmos DB database accounts available under the given resource group.
SELECT
id,
name,
analyticalStorageConfiguration,
apiProperties,
backupPolicy,
capabilities,
capacity,
connectorOffer,
consistencyPolicy,
cors,
createMode,
customerManagedKeyStatus,
databaseAccountOfferType,
defaultIdentity,
defaultPriorityLevel,
disableKeyBasedMetadataWriteAccess,
disableLocalAuth,
documentEndpoint,
enableAnalyticalStorage,
enableAutomaticFailover,
enableBurstCapacity,
enableCassandraConnector,
enableFreeTier,
enableMultipleWriteLocations,
enablePartitionMerge,
enablePerRegionPerPartitionAutoscale,
enablePriorityBasedExecution,
enforceHierarchicalPartitionKeyIdLastLevel,
failoverPolicies,
identity,
instanceId,
ipRules,
isVirtualNetworkFilterEnabled,
keyVaultKeyUri,
keyVaultKeyUriVersion,
keysMetadata,
kind,
location,
locations,
minimalTlsVersion,
networkAclBypass,
networkAclBypassResourceIds,
privateEndpointConnections,
provisioningState,
publicNetworkAccess,
readLocations,
restoreParameters,
systemData,
tags,
type,
virtualNetworkRules,
writeLocations
FROM azure.cosmosdb.database_accounts
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Lists all the Azure Cosmos DB database accounts available under the subscription.
SELECT
id,
name,
analyticalStorageConfiguration,
apiProperties,
backupPolicy,
capabilities,
capacity,
connectorOffer,
consistencyPolicy,
cors,
createMode,
customerManagedKeyStatus,
databaseAccountOfferType,
defaultIdentity,
defaultPriorityLevel,
disableKeyBasedMetadataWriteAccess,
disableLocalAuth,
documentEndpoint,
enableAnalyticalStorage,
enableAutomaticFailover,
enableBurstCapacity,
enableCassandraConnector,
enableFreeTier,
enableMultipleWriteLocations,
enablePartitionMerge,
enablePerRegionPerPartitionAutoscale,
enablePriorityBasedExecution,
enforceHierarchicalPartitionKeyIdLastLevel,
failoverPolicies,
identity,
instanceId,
ipRules,
isVirtualNetworkFilterEnabled,
keyVaultKeyUri,
keyVaultKeyUriVersion,
keysMetadata,
kind,
location,
locations,
minimalTlsVersion,
networkAclBypass,
networkAclBypassResourceIds,
privateEndpointConnections,
provisioningState,
publicNetworkAccess,
readLocations,
restoreParameters,
systemData,
tags,
type,
virtualNetworkRules,
writeLocations
FROM azure.cosmosdb.database_accounts
WHERE subscription_id = '{{ subscription_id }}' -- required
;
INSERT examples
- create_or_update
- Manifest
Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account.
INSERT INTO azure.cosmosdb.database_accounts (
location,
tags,
identity,
kind,
properties,
resource_group_name,
account_name,
subscription_id
)
SELECT
'{{ location }}',
'{{ tags }}',
'{{ identity }}',
'{{ kind }}',
'{{ properties }}' /* required */,
'{{ resource_group_name }}',
'{{ account_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
identity,
kind,
location,
properties,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: database_accounts
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the database_accounts resource.
- name: account_name
value: "{{ account_name }}"
description: Required parameter for the database_accounts resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the database_accounts resource.
- name: location
value: "{{ location }}"
description: |
The location of the resource group to which the resource belongs.
- name: tags
value: "{{ tags }}"
description: |
Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
- name: identity
description: |
Identity for the resource.
value:
principalId: "{{ principalId }}"
tenantId: "{{ tenantId }}"
type: "{{ type }}"
userAssignedIdentities: "{{ userAssignedIdentities }}"
- name: kind
value: "{{ kind }}"
description: |
Indicates the type of database account. This can only be set at database account creation. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse".
valid_values: ['GlobalDocumentDB', 'MongoDB', 'Parse']
- name: properties
description: |
Properties to create and update Azure Cosmos DB database accounts. Required.
value:
consistencyPolicy:
defaultConsistencyLevel: "{{ defaultConsistencyLevel }}"
maxStalenessPrefix: {{ maxStalenessPrefix }}
maxIntervalInSeconds: {{ maxIntervalInSeconds }}
locations:
- id: "{{ id }}"
locationName: "{{ locationName }}"
documentEndpoint: "{{ documentEndpoint }}"
provisioningState: "{{ provisioningState }}"
failoverPriority: {{ failoverPriority }}
isZoneRedundant: {{ isZoneRedundant }}
databaseAccountOfferType: "{{ databaseAccountOfferType }}"
ipRules:
- ipAddressOrRange: "{{ ipAddressOrRange }}"
isVirtualNetworkFilterEnabled: {{ isVirtualNetworkFilterEnabled }}
enableAutomaticFailover: {{ enableAutomaticFailover }}
capabilities:
- name: "{{ name }}"
virtualNetworkRules:
- id: "{{ id }}"
ignoreMissingVNetServiceEndpoint: {{ ignoreMissingVNetServiceEndpoint }}
enableMultipleWriteLocations: {{ enableMultipleWriteLocations }}
enableCassandraConnector: {{ enableCassandraConnector }}
connectorOffer: "{{ connectorOffer }}"
disableKeyBasedMetadataWriteAccess: {{ disableKeyBasedMetadataWriteAccess }}
keyVaultKeyUri: "{{ keyVaultKeyUri }}"
defaultIdentity: "{{ defaultIdentity }}"
publicNetworkAccess: "{{ publicNetworkAccess }}"
enableFreeTier: {{ enableFreeTier }}
apiProperties:
serverVersion: "{{ serverVersion }}"
enableAnalyticalStorage: {{ enableAnalyticalStorage }}
analyticalStorageConfiguration:
schemaType: "{{ schemaType }}"
createMode: "{{ createMode }}"
backupPolicy:
type: "{{ type }}"
migrationState:
status: "{{ status }}"
targetType: "{{ targetType }}"
startTime: "{{ startTime }}"
cors:
- allowedOrigins: "{{ allowedOrigins }}"
allowedMethods: "{{ allowedMethods }}"
allowedHeaders: "{{ allowedHeaders }}"
exposedHeaders: "{{ exposedHeaders }}"
maxAgeInSeconds: {{ maxAgeInSeconds }}
networkAclBypass: "{{ networkAclBypass }}"
networkAclBypassResourceIds:
- "{{ networkAclBypassResourceIds }}"
disableLocalAuth: {{ disableLocalAuth }}
restoreParameters:
restoreSource: "{{ restoreSource }}"
restoreTimestampInUtc: "{{ restoreTimestampInUtc }}"
restoreWithTtlDisabled: {{ restoreWithTtlDisabled }}
restoreMode: "{{ restoreMode }}"
databasesToRestore:
- databaseName: "{{ databaseName }}"
collectionNames: "{{ collectionNames }}"
gremlinDatabasesToRestore:
- databaseName: "{{ databaseName }}"
graphNames: "{{ graphNames }}"
tablesToRestore:
- "{{ tablesToRestore }}"
sourceBackupLocation: "{{ sourceBackupLocation }}"
capacity:
totalThroughputLimit: {{ totalThroughputLimit }}
keysMetadata:
primaryMasterKey:
generationTime: "{{ generationTime }}"
secondaryMasterKey:
generationTime: "{{ generationTime }}"
primaryReadonlyMasterKey:
generationTime: "{{ generationTime }}"
secondaryReadonlyMasterKey:
generationTime: "{{ generationTime }}"
enablePartitionMerge: {{ enablePartitionMerge }}
enableBurstCapacity: {{ enableBurstCapacity }}
minimalTlsVersion: "{{ minimalTlsVersion }}"
customerManagedKeyStatus: "{{ customerManagedKeyStatus }}"
enablePriorityBasedExecution: {{ enablePriorityBasedExecution }}
defaultPriorityLevel: "{{ defaultPriorityLevel }}"
enablePerRegionPerPartitionAutoscale: {{ enablePerRegionPerPartitionAutoscale }}
enforceHierarchicalPartitionKeyIdLastLevel: {{ enforceHierarchicalPartitionKeyIdLastLevel }}
UPDATE examples
- update
Updates the properties of an existing Azure Cosmos DB database account.
UPDATE azure.cosmosdb.database_accounts
SET
tags = '{{ tags }}',
location = '{{ location }}',
identity = '{{ identity }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND account_name = '{{ account_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
identity,
kind,
location,
properties,
systemData,
tags,
type;
REPLACE examples
- create_or_update
Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account.
REPLACE azure.cosmosdb.database_accounts
SET
location = '{{ location }}',
tags = '{{ tags }}',
identity = '{{ identity }}',
kind = '{{ kind }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND account_name = '{{ account_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND properties = '{{ properties }}' --required
RETURNING
id,
name,
identity,
kind,
location,
properties,
systemData,
tags,
type;
DELETE examples
- delete
Deletes an existing Azure Cosmos DB database account.
DELETE FROM azure.cosmosdb.database_accounts
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND account_name = '{{ account_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;
Lifecycle Methods
- list_keys
- list_connection_strings
- list_read_only_keys
- get_read_only_keys
- list_usages
- list_metric_definitions
- failover_priority_change
- offline_region
- online_region
- regenerate_key
- check_name_exists
Lists the access keys for the specified Azure Cosmos DB database account.
EXEC azure.cosmosdb.database_accounts.list_keys
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Lists the connection strings for the specified Azure Cosmos DB database account.
EXEC azure.cosmosdb.database_accounts.list_connection_strings
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Lists the read-only access keys for the specified Azure Cosmos DB database account.
EXEC azure.cosmosdb.database_accounts.list_read_only_keys
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Lists the read-only access keys for the specified Azure Cosmos DB database account.
EXEC azure.cosmosdb.database_accounts.get_read_only_keys
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Retrieves the usages (most recent data) for the given database account.
EXEC azure.cosmosdb.database_accounts.list_usages
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@$filter='{{ $filter }}'
;
Retrieves metric definitions for the given database account.
EXEC azure.cosmosdb.database_accounts.list_metric_definitions
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
EXEC azure.cosmosdb.database_accounts.failover_priority_change
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"failoverPolicies": "{{ failoverPolicies }}"
}'
;
Offline the specified region for the specified Azure Cosmos DB database account.
EXEC azure.cosmosdb.database_accounts.offline_region
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"region": "{{ region }}"
}'
;
Online the specified region for the specified Azure Cosmos DB database account.
EXEC azure.cosmosdb.database_accounts.online_region
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"region": "{{ region }}"
}'
;
Regenerates an access key for the specified Azure Cosmos DB database account.
EXEC azure.cosmosdb.database_accounts.regenerate_key
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"keyKind": "{{ keyKind }}"
}'
;
Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters.
EXEC azure.cosmosdb.database_accounts.check_name_exists
@account_name='{{ account_name }}' --required
;