PowerShell Module for working with Azure Cosmos DB databases, collections, documents, attachments, offers, users, permissions, triggers, stored procedures and user defined functions.
This PR adds support for RBAC using Entra ID tokens. It updates the New-CosmosDbContext function with two new parameters and parameter sets.
It also adds the Get-CosmosDbEntraIdToken function which is a utility function for generating the Access token (wrapping Get-AzAccessToken)
Also fixes #482
This PR also importantly updates the dependency on the PowerShell modules Az.Accounts to v2.19.0 and Az.Resources v6.16.2 to the latest version which is why I've triggered it as a breaking change. This was not strictly necessary, but due to updating the sampler builder code it required the same version to be used. If something thinks this is a major issue I can roll it back, but felt it is better to take dependency on recent versions.
Bug Fixes
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.
Added
Added support for setting an Entra Id OAuth2 Token in the New-CosmosDbContext - Fixes Issue #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
Pull Request
This PR adds support for RBAC using Entra ID tokens. It updates the
New-CosmosDbContext
function with two new parameters and parameter sets.It also adds the
Get-CosmosDbEntraIdToken
function which is a utility function for generating the Access token (wrappingGet-AzAccessToken
)Also fixes #482
This PR also importantly updates the dependency on the PowerShell modules
Az.Accounts
to v2.19.0 andAz.Resources
v6.16.2 to the latest version which is why I've triggered it as a breaking change. This was not strictly necessary, but due to updating the sampler builder code it required the same version to be used. If something thinks this is a major issue I can roll it back, but felt it is better to take dependency on recent versions.Bug Fixes
Az.Accounts
v2.19.0 or newer andAz.Resources
v6.16.2 or newer.New-CosmosDbAuthorizationHeader
toGet-CosmosDbAuthorizationHeaderFromContext
to better indicate actual function behaviour.Get-CosmosDbAuthorizationHeadersFromContext
toGet-CosmosDbAuthorizationHeaderFromContextResourceToken
to better indicate actual function behaviour and align naming convention.Invoke-CosmosDbRequest
to clean up logic to generate the authorization header.Get-CosmosDbAuthorizationHeaderFromContextEntraId
to generate the authorization header when an Entra ID Token is provided in the context. This function is used byInvoke-CosmosDbRequest
to generate the authorization header when an Entra ID Token is provided.Added
New-CosmosDbContext
- Fixes Issue #479.Get-CosmosDbEntraIdToken
function that usesGet-AzAccessToken
to get an Entra Id Token for use in Cosmos DB requests. This is used byNew-CosmosDbContext
to set the Entra Id Token in theThis change is