Azure PowerShell samples for Azure Cosmos DB - SQL (Core) API

The following table includes links to commonly used Azure PowerShell scripts for Azure Cosmos DB for SQL (Core) API. If you'd like to fork these PowerShell samples for Cosmos DB from our GitHub repository, visit Cosmos DB PowerShell Samples on GitHub.

For additional Cosmos DB PowerShell samples for SQL (Core) API and documentation, see Manage Azure Cosmos DB SQL API resources using PowerShell. For Cosmos DB PowerShell samples for other APIs, see Cassandra API, MongoDB API, Gremlin API, and Table API.

Note

The samples use Az.CosmosDB management cmdlets. Please check for updates to Az.CosmosDB regularly.

Task Description
Create an account, database and container Create an Azure Cosmos DB account, database and container.
Create a container with a large partition key Create a container with a large partition key.
List or get databases or containers List or get database or containers.
Get RU/s Get RU/s for a database or container.
Update RU/s Update RU/s for a database or container.
Create a container with no index policy Create an Azure Cosmos container with index policy turned off.
Update an account Update a Cosmos DB account's default consistency level.
Update an account's regions Update a Cosmos DB account's regions.
Change failover priority or trigger failover Change the regional failover priority of an Azure Cosmos account or trigger a manual failover.
Account keys or connection strings Get primary and secondary keys, connection strings or regenerate an account key of an Azure Cosmos DB account.
Create a Cosmos Account with IP Firewall Create an Azure Cosmos DB account with IP Firewall enabled.
Lock resources from deletion Prevent resources from being deleted with resource locks.