BREAKING CHANGE: Add Support for RBAC using Entra ID Token via New-CosmosDbContext - Fixes #479#483
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
This PR adds support for RBAC using Entra ID tokens. It updates the
New-CosmosDbContextfunction with two new parameters and parameter sets.It also adds the
Get-CosmosDbEntraIdTokenfunction 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.Accountsto v2.19.0 andAz.Resourcesv6.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.Accountsv2.19.0 or newer andAz.Resourcesv6.16.2 or newer.
New-CosmosDbAuthorizationHeadertoGet-CosmosDbAuthorizationHeaderFromContextto better indicateactual function behaviour.
Get-CosmosDbAuthorizationHeadersFromContexttoGet-CosmosDbAuthorizationHeaderFromContextResourceTokento betterindicate actual function behaviour and align naming convention.
Invoke-CosmosDbRequestto clean up logic to generate the authorization header.Get-CosmosDbAuthorizationHeaderFromContextEntraIdto generate the authorizationheader when an Entra ID Token is provided in the context. This function is used by
Invoke-CosmosDbRequesttogenerate the authorization header when an Entra ID Token is provided.
Added
New-CosmosDbContext- Fixes Issue #479.Get-CosmosDbEntraIdTokenfunction that usesGet-AzAccessTokento get an Entra Id Tokenfor use in Cosmos DB requests. This is used by
New-CosmosDbContextto set the Entra Id Token in theThis change is