Skip to content

BREAKING CHANGE: Add Support for RBAC using Entra ID Token via New-CosmosDbContext - Fixes #479#483

Merged
PlagueHO merged 22 commits into
mainfrom
Issue-479
May 19, 2024
Merged

BREAKING CHANGE: Add Support for RBAC using Entra ID Token via New-CosmosDbContext - Fixes #479#483
PlagueHO merged 22 commits into
mainfrom
Issue-479

Conversation

@PlagueHO
Copy link
Copy Markdown
Owner

@PlagueHO PlagueHO commented May 19, 2024

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 (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

This change is Reviewable

@PlagueHO PlagueHO merged commit a83196e into main May 19, 2024
@PlagueHO PlagueHO deleted the Issue-479 branch May 19, 2024 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant