Skip to main content

database_accounts

Creates, updates, deletes, gets or lists a database_accounts resource.

Overview

Namedatabase_accounts
TypeResource
Idazure.cosmos_db.database_accounts

Fields

The following fields are returned by SELECT queries:

The database account properties were retrieved successfully.

NameDatatypeDescription
idstringThe unique resource identifier of the ARM resource.
namestringThe name of the ARM resource.
identityobjectIdentity for the resource.
kindstringIndicates the type of database account. This can only be set at database account creation. (default: GlobalDocumentDB)
locationstringThe location of the resource group to which the resource belongs.
propertiesobjectProperties for the database account.
systemDataobjectThe system meta data relating to this resource.
tagsobjectTags 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".
typestringThe type of Azure resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubscriptionId, resourceGroupName, accountNameRetrieves the properties of an existing Azure Cosmos DB database account.
list_by_resource_groupselectresourceGroupName, subscriptionIdLists all the Azure Cosmos DB database accounts available under the given resource group.
listselectsubscriptionIdLists all the Azure Cosmos DB database accounts available under the subscription.
create_or_updateinsertsubscriptionId, resourceGroupName, accountName, data__propertiesCreates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account.
updateupdatesubscriptionId, resourceGroupName, accountNameUpdates the properties of an existing Azure Cosmos DB database account.
deletedeletesubscriptionId, resourceGroupName, accountNameDeletes an existing Azure Cosmos DB database account.
failover_priority_changeexecsubscriptionId, resourceGroupName, accountName, failoverPoliciesChanges 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_regionexecsubscriptionId, resourceGroupName, accountName, regionOffline the specified region for the specified Azure Cosmos DB database account.
online_regionexecsubscriptionId, resourceGroupName, accountName, regionOnline the specified region for the specified Azure Cosmos DB database account.
regenerate_keyexecsubscriptionId, resourceGroupName, accountName, keyKindRegenerates an access key for the specified Azure Cosmos DB database account.

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.

NameDatatypeDescription
accountNamestringCosmos DB database account name.
resourceGroupNamestringThe name of the resource group. The name is case insensitive.
subscriptionIdstringThe ID of the target subscription.

SELECT examples

Retrieves the properties of an existing Azure Cosmos DB database account.

SELECT
id,
name,
identity,
kind,
location,
properties,
systemData,
tags,
type
FROM azure.cosmos_db.database_accounts
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND accountName = '{{ accountName }}' -- required
;

INSERT examples

Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an account.

INSERT INTO azure.cosmos_db.database_accounts (
data__kind,
data__identity,
data__properties,
data__location,
data__tags,
subscriptionId,
resourceGroupName,
accountName
)
SELECT
'{{ kind }}',
'{{ identity }}',
'{{ properties }}' /* required */,
'{{ location }}',
'{{ tags }}',
'{{ subscriptionId }}',
'{{ resourceGroupName }}',
'{{ accountName }}'
RETURNING
id,
name,
identity,
kind,
location,
properties,
systemData,
tags,
type
;

UPDATE examples

Updates the properties of an existing Azure Cosmos DB database account.

UPDATE azure.cosmos_db.database_accounts
SET
data__tags = '{{ tags }}',
data__location = '{{ location }}',
data__identity = '{{ identity }}',
data__properties = '{{ properties }}'
WHERE
subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND accountName = '{{ accountName }}' --required
RETURNING
id,
name,
identity,
kind,
location,
properties,
systemData,
tags,
type;

DELETE examples

Deletes an existing Azure Cosmos DB database account.

DELETE FROM azure.cosmos_db.database_accounts
WHERE subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND accountName = '{{ accountName }}' --required
;

Lifecycle Methods

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.cosmos_db.database_accounts.failover_priority_change 
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@accountName='{{ accountName }}' --required
@@json=
'{
"failoverPolicies": "{{ failoverPolicies }}"
}'
;