Skip to content

Command Reference

Jiri Formacek edited this page Jul 4, 2026 · 1 revision

Command Reference

Quick-reference table of all commands exported by the CosmosLite module.

All Exported Commands

Command Category Description
Connect-Cosmos Connection Creates a CosmosLite connection context (supports 6 authentication modes).
Get-CosmosConnection Connection Returns the currently cached connection object.
Get-CosmosAccessToken Connection Acquires an Entra ID access token for the current connection (diagnostics).
Set-CosmosRetryCount Connection Updates the HTTP 429 retry limit on an existing connection.
Get-CosmosDocument Documents Reads a document by Id and PartitionKey.
New-CosmosDocument Documents Inserts or upserts a document.
Set-CosmosDocument Documents Replaces an existing document completely.
Remove-CosmosDocument Documents Deletes one or more documents.
Invoke-CosmosQuery Queries Executes a SQL query with optional pagination, parameterization, and auto-continue.
New-CosmosDocumentUpdate Partial Updates Creates an update descriptor for Update-CosmosDocument.
New-CosmosUpdateOperation Partial Updates Creates a single patch operation (Add/Set/Replace/Remove/Increment/Move).
Update-CosmosDocument Partial Updates Sends partial patch operations to Cosmos DB.
Invoke-CosmosStoredProcedure Stored Procedures Executes a stored procedure within a partition.
Get-CosmosCollectionPartitionKeyRanges Infrastructure Returns partition key range metadata for cross-partition query fan-out.
Assert-CosmosResult Utilities Validates a response object and throws CosmosLiteException on failure.

Response Object Fields

Field Type Description
IsSuccess Boolean $true on HTTP 2xx
HttpCode HttpStatusCode HTTP status code
Charge Double RU cost
Data Object Documents or error payload
Continuation String Pagination token ($null on last page)
Headers Hashtable Server headers (when CollectResponseHeaders is set)

Common Parameters on Data Commands

Parameter Default Description
Collection Target collection name (required on all data commands)
Context last Connect-Cosmos result CosmosLite.Connection object
BatchSize 1 Degree of parallel request processing

Module Information

Property Value
Module version 3.1.2
PowerShell compatibility Core + Desktop
Author Jiri Formacek
Company GreyCorbel Solutions
PSGallery CosmosLite
Project github.com/GreyCorbel/CosmosLite
Required module AadAuthenticationFactory ≥ 3.0.2

Installation

Install-Module AadAuthenticationFactory   # required
Install-Module CosmosLite

Clone this wiki locally