CosmosDB

5.0.0-preview0002

This module provides cmdlets for working with Azure Cosmos DB databases, collections, documents, attachments, offers, users, permissions, triggers, stored procedures and user defined functions.

Minimum PowerShell version

5.1

This is a prerelease version of CosmosDB.
There is a newer prerelease version of this module available.
See the version list below for details.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name CosmosDB -RequiredVersion 5.0.0-preview0002 -AllowPrerelease

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name CosmosDB -Version 5.0.0-preview0002 -Prerelease

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) Daniel Scott-Raynsford. All rights reserved.

Package Details

Author(s)

  • Daniel Scott-Raynsford

Tags

CosmosDB DocumentDb Azure Windows Linux MacOS

Functions

Get-CosmosDbAccount Get-CosmosDbAccountConnectionString Get-CosmosDbAccountMasterKey New-CosmosDbAccount New-CosmosDbAccountMasterKey Remove-CosmosDbAccount Set-CosmosDbAccount Get-CosmosDbAttachment Get-CosmosDbAttachmentResourcePath New-CosmosDbAttachment Remove-CosmosDbAttachment Set-CosmosDbAttachment Get-CosmosDbCollection Get-CosmosDbCollectionResourcePath Get-CosmosDbCollectionSize New-CosmosDbCollection New-CosmosDbCollectionCompositeIndexElement New-CosmosDbCollectionExcludedPath New-CosmosDbCollectionIncludedPath New-CosmosDbCollectionIncludedPathIndex New-CosmosDbCollectionIndexingPolicy New-CosmosDbCollectionUniqueKey New-CosmosDbCollectionUniqueKeyPolicy Remove-CosmosDbCollection Set-CosmosDbCollection Get-CosmosDbDatabase Get-CosmosDbDatabaseResourcePath New-CosmosDbDatabase Remove-CosmosDbDatabase Get-CosmosDbDocument Get-CosmosDbDocumentJson Get-CosmosDbDocumentResourcePath New-CosmosDbDocument Remove-CosmosDbDocument Set-CosmosDbDocument Get-CosmosDbOffer Get-CosmosDbOfferResourcePath Set-CosmosDbOffer Get-CosmosDbPermission Get-CosmosDbPermissionResourcePath New-CosmosDbPermission Remove-CosmosDbPermission Get-CosmosDbStoredProcedure Get-CosmosDbStoredProcedureResourcePath Invoke-CosmosDbStoredProcedure New-CosmosDbStoredProcedure Remove-CosmosDbStoredProcedure Set-CosmosDbStoredProcedure Get-CosmosDbTrigger Get-CosmosDbTriggerResourcePath New-CosmosDbTrigger Remove-CosmosDbTrigger Set-CosmosDbTrigger Get-CosmosDbUserDefinedFunction Get-CosmosDbUserDefinedFunctionResourcePath New-CosmosDbUserDefinedFunction Remove-CosmosDbUserDefinedFunction Set-CosmosDbUserDefinedFunction Get-CosmosDbUser Get-CosmosDbUserResourcePath New-CosmosDbUser Remove-CosmosDbUser Set-CosmosDbUser Set-CosmosDbUserType Get-CosmosDbContinuationToken Get-CosmosDbEntraIdToken Get-CosmosDbResponseHeaderAttribute New-CosmosDbBackoffPolicy New-CosmosDbContext New-CosmosDbContextToken

PSEditions

Core Desktop

Dependencies

Release Notes

## [5.0.0-preview0002] - 2024-05-19

### Fixed

- Removed unnecessary quotes from README (works without them in PowerShell and is easier to read)
- Modified README to use splats, which is part of the recommended style guide
- Removed Ubuntu-18.04 testing from build pipeline because it is no longer supported by Microsoft
 managed Azure DevOps images - Fixes [Issue #473](https://github.com/PlagueHO/CosmosDB/issues/473).
- Added Ubuntu-22.04 testing to build pipeline - Fixes [Issue #474](https://github.com/PlagueHO/CosmosDB/issues/474).
- Removed MacOS-10.15 testing from build pipeline because it is no longer supported by Microsoft
 managed Azure DevOps images - Fixes [Issue #476](https://github.com/PlagueHO/CosmosDB/issues/476).
- Added macOS-12 testing to build pipeline - Fixes [Issue #477](https://github.com/PlagueHO/CosmosDB/issues/477).
- Changed integration tests to deploy Cosmos DB using Bicep.
- Update `requirements.psd1` to install modules `Az.Accounts` 2.19.0 and `Az.Resources` 6.16.2.
- Renamed `New-CosmosDbAuthorizationToken` to `New-CosmosDbAuthorizationHeader` to better indicate
 actual function return type.
- Refactored `Invoke-CosmosDbRequest` to support getting the EntraIdToken property from the context object
 and using it for authentication if it is provided. If the Key property is provided, the EntraIdToken property
 will take precendence and the key will be ignored.
- Updated CI pipeline to use `PublishCodeCoverageResults@2` task rather than `PublishCodeCoverageResults@1`
 task to support the latest version of the task.

### Changed

- BREAKING CHANGE: Updated module to require `Az.Accounts` v2.19.0 or newer and `Az.Resources`
 v6.16.2 or newer.
- Renamed `New-CosmosDbAuthorizationHeader` to `Get-CosmosDbAuthorizationHeaderFromContext` to better indicate
 actual function behaviour.
- Renamed `Get-CosmosDbAuthorizationHeadersFromContext` to `Get-CosmosDbAuthorizationHeaderFromContextResourceToken` to better
 indicate actual function behaviour and align naming convention.
- Refactored `Invoke-CosmosDbRequest` to clean up logic to generate the authorization header.
- Added new utillity function `Get-CosmosDbAuthorizationHeaderFromContextEntraId` to generate the authorization
 header when an Entra ID Token is provided in the context. This function is used by `Invoke-CosmosDbRequest` to
 generate the authorization header when an Entra ID Token is provided.
- Changed module import process to load the `Az.Accounts` and `Az.Resources` modules
 only if they haven't already been loaded to support saving the module and storing in
 folders.

### Added

- Added support for setting an Entra Id OAuth2 Token in the `New-CosmosDbContext` - Fixes [Issue #479](https://github.com/PlagueHO/CosmosDB/issues/479).
- Added new `Get-CosmosDbEntraIdToken` function that uses `Get-AzAccessToken` to get an Entra Id Token
 for use in Cosmos DB requests. This is used by `New-CosmosDbContext` to set the Entra Id Token in the
 context object - Fixes [Issue #479](https://github.com/PlagueHO/CosmosDB/issues/479).

FileList

Version History

Version Downloads Last updated
7.0.0 280,384 6/26/2026
7.0.0-previe... 247 4/29/2026
6.1.1-previe... 595 6/8/2025
6.1.0 1,382,421 6/8/2025
6.1.0-previe... 11 6/8/2025
6.1.0-previe... 14 6/1/2025
6.0.2-previe... 28 5/12/2025
6.0.2-previe... 9 5/10/2025
6.0.1 102,087 5/9/2025
6.0.1-previe... 8 5/9/2025
6.0.0 66,410 4/26/2025
6.0.0-previe... 7 4/26/2025
5.2.0-previe... 30 4/14/2025
5.1.0 582,110 12/15/2024
5.1.0-previe... 7 12/14/2024
5.0.1-previe... 210 10/18/2024
5.0.1-previe... 224 8/12/2024
5.0.0 571,731 6/7/2024
5.0.0-previe... (current version) 112,904 5/19/2024
5.0.0-previe... 11 5/19/2024
4.7.0 1,427,827 1/29/2023
4.7.0-previe... 22 1/22/2023
4.6.0 110,823 8/7/2022
4.6.0-previe... 41 8/7/2022
4.6.0-previe... 226 5/30/2022
4.6.0-previe... 248 9/17/2021
4.6.0-previe... 41 9/2/2021
4.5.0 273,560 5/29/2021
4.5.0-previe... 39 5/23/2021
4.5.0-previe... 41 5/23/2021
4.4.3 53,097 11/13/2020
4.4.3-previe... 39 11/12/2020
4.4.2 2,768 11/11/2020
4.4.2-previe... 39 11/11/2020
4.4.1 2,435 10/27/2020
4.4.1-previe... 38 10/27/2020
4.4.0 6,005 8/30/2020
4.4.0-previe... 40 8/30/2020
4.3.0 4,831 8/11/2020
4.3.0-previe... 42 8/10/2020
4.2.2-previe... 41 8/8/2020
4.2.2-previe... 40 8/8/2020
4.2.1 12,754 6/15/2020
4.2.1-previe... 43 6/15/2020
4.2.0 3,053 6/1/2020
4.2.0-previe... 41 6/1/2020
4.2.0-previe... 42 5/31/2020
4.2.0-previe... 40 5/31/2020
4.2.0-previe... 41 5/30/2020
4.1.0 9,679 5/15/2020
4.1.0-previe... 862 5/15/2020
4.0.0 1,976 5/11/2020
4.0.0-previe... 415 5/11/2020
4.0.0-previe... 418 5/11/2020
3.7.0 9,502 3/24/2020
3.7.0-previe... 422 3/24/2020
3.6.2-previe... 419 3/21/2020
3.6.2-previe... 420 3/20/2020
3.6.2-previe... 419 3/20/2020
3.6.1 10,674 3/19/2020
3.6.1-previe... 421 3/19/2020
3.5.2.487 1,167 3/14/2020
3.5.1.458 25,015 11/12/2019
3.5.0.426 44,122 7/20/2019
3.4.0.411 1,505 6/29/2019
3.3.0.405 927 6/22/2019
3.2.4.376 1,753 5/30/2019
3.2.3.359 5,274 4/5/2019
3.2.2.347 1,176 3/20/2019
3.2.1.332 2,071 2/22/2019
3.2.0.320 1,586 2/7/2019
3.1.0.293 7,125 12/26/2018
3.0.0.279 2,014 12/23/2018
2.1.15.239 136,046 11/18/2018
2.1.14.222 976 11/15/2018
2.1.13.215 1,977 11/6/2018
2.1.12.137 1,405 10/29/2018
2.1.11.130 503 10/27/2018
2.1.10.104 849 10/22/2018
2.1.10.103 432 10/22/2018
2.1.9.95 483 10/21/2018
2.1.8.59 1,870 10/3/2018
2.1.8.58 422 10/3/2018
2.1.7.675 7,951 9/11/2018
2.1.7.635 515 9/10/2018
2.1.6.561 21,731 8/24/2018
2.1.5.548 1,420 8/4/2018
2.1.4.536 948 7/25/2018
2.1.3.528 6,914 7/12/2018
2.1.2.514 741 7/3/2018
2.1.1.498 563 6/26/2018
2.1.0.487 471 6/24/2018
2.0.16.465 703 6/20/2018
2.0.15.454 574 6/15/2018
2.0.14.439 572 6/12/2018
2.0.13.427 694 6/3/2018
2.0.12.418 1,637 5/20/2018
2.0.11.407 2,322 5/12/2018
2.0.10.388 814 4/26/2018
2.0.10.382 447 4/25/2018
2.0.9.364 658 4/9/2018
2.0.9.360 426 4/9/2018
2.0.8.350 498 4/5/2018
2.0.7.288 3,316 3/11/2018
2.0.6.247 459 3/9/2018
2.0.5.216 517 3/5/2018
2.0.4.202 836 2/27/2018
2.0.3.190 1,759 2/24/2018
2.0.2.184 435 2/24/2018
2.0.1.173 3,604 1/27/2018
2.0.0.163 1,208 1/14/2018
2.0.0.152 514 12/23/2017
1.0.12.126 458 12/8/2017
1.0.11.117 438 12/8/2017
1.0.10.108 443 12/6/2017
1.0.9.100 452 11/5/2017
1.0.8.91 459 11/5/2017
1.0.7.85 444 11/3/2017
1.0.6.79 440 11/2/2017
Show less