Azure PowerShell samples for Azure Cosmos DB


The Azure Cosmos DB DocumentDB API or SQL (DocumentDB) API is now known as Azure Cosmos DB SQL API. You don't need to change anything to continue running your apps built with DocumentDB API. The functionality remains the same.

The following table includes links to sample Azure PowerShell scripts for Azure Cosmos DB. At this time you can only manage the Azure Cosmos DB accountlayer via PowerShell; other resources such as databases and collections cannot be managed via PowerShell.

Create an Azure Cosmos DB account
Create a SQL API account Creates a single Azure Cosmos DB account to use with the SQL API.
Scale Azure Cosmos DB
Replicate Azure Cosmos DB account in multiple regions and configure failover priorities Globally replicates account data into multiple regions with a specified failover priority.
Secure Azure Cosmos DB
Get account keys Gets the primary and secondary master write keys and primary and secondary read-only keys for the account.
Get MongoDB connection string Gets the connection string to connect your MongoDB app to your Azure Cosmos DB account.
Regenerate account keys Regenerates the master or read-only key for the account.
Create a firewall Creates an inbound IP access control policy to limit access to the account from an approved set of machines and/or cloud services.
High availability, disaster recovery, backup and restore
Configure failover policy Sets the failover priority of each region in which the account is replicated.