| Branch | GitHub Actions | Automated Tests | Code Quality |
|---|---|---|---|
| main |
This PowerShell module provides cmdlets for accessing Cosmos DB collections via the Azure Cosmos DB REST API. It makes it easy to perform CRUD operations on Cosmos DB collections and documents and related entities while also implementing role-based access control or token-based authentication.
Important
The CosmosDB PowerShell module is not intended to be a replacement for the Az.CosmosDB. Although there is some cross-over between the two modules, the CosmosDB PowerShell module is primarily intended to be used for accessing the documents within collections using RBAC and token-based authentication. This is functionality that the Az.CosmosDB module does not currently provide.
The CosmosDB PowerShell module enables management of:
- Attachments
- Collections
- Databases
- Documents
- Offers
- Permissions
- Stored Procedures
- Triggers
- User Defined Functions
- Users
The module uses the Cosmos DB (DocumentDB) REST APIs. For more information on the Cosmos DB REST APIs, see this link.
For full usage documentation — contexts, authentication, working with databases, collections, documents, stored procedures, and more — see the User Guide.
This module requires the following:
- Windows PowerShell 5.x, PowerShell Core 6.x or PowerShell 7.x
- Az.Accounts: 5.0.0 and newer.
- Az.Resources: 8.0.0 and newer.
These modules are required if using New-CosmosDbContext -ResourceGroupName $resourceGroup
or *-CosmosDbAccount functions.
To install the module from PowerShell Gallery, use the PowerShell Cmdlet:
Install-Module -Name CosmosDBThis PowerShell module is automatically tested and validated to run on the following systems:
- Windows Server (using Windows PowerShell 5.1):
- Windows Server 2022: Using GitHub Actions.
- Windows Server 2025: Using GitHub Actions.
- Windows Server (using Windows PowerShell 7.x):
- Windows Server 2022: Using GitHub Actions.
- Windows Server 2025: Using GitHub Actions.
- Linux (using PowerShell 7.x):
- Ubuntu 22.04: Using GitHub Actions.
- Ubuntu 24.04: Using GitHub Actions.
- macOS (using PowerShell 7.x):
- macOS 14: Using GitHub Actions.
- macOS 15: Using GitHub Actions.
This module is no longer tested on PowerShell Core 6.x as PowerShell 7.x should be used. It should still work, but will no longer be verified. Issues with this module that only exist on PowerShell Core 6.x but not PowerShell 7.x will not be fixed.
This module should function correctly on other systems and configurations but is not automatically tested with them in every change.
If you wish to contribute to this project, please read the Contributing.md document first. We would be very grateful of any contributions.
A list of Cmdlets in the CosmosDB PowerShell module can be found by running the following PowerShell commands:
Import-Module -Name CosmosDB
Get-Command -Module CosmosDBHelp on individual Cmdlets can be found in the built-in Cmdlet help:
Get-Help -Name Get-CosmosDBUserThe details of the cmdlets contained in this module can also be found in the wiki.
For a list of changes to versions, see the CHANGELOG.md file.