Authentication: Add Service Principal and Azure CLI support#17
Open
ZanattaMichael wants to merge 1 commit into
Open
Authentication: Add Service Principal and Azure CLI support#17ZanattaMichael wants to merge 1 commit into
ZanattaMichael wants to merge 1 commit into
Conversation
- Fix existing bug: Update-AzManagedIdentity now returns the token so Add-AuthenticationHTTPHeader's assignment captures it correctly - Add ServicePrincipal and AzureCLI to TokenType enum; Certificate was already defined but unimplemented - Add three new token classes: ServicePrincipalToken, CertificateToken, AzureCliToken — each inherits AuthenticationToken with expiry checking - ServicePrincipalToken.GetClientSecret() enforces call stack restriction so only Update-AzServicePrincipal can retrieve the stored secret - Add OAuth 2.0 client credentials flow for service principals (Get-AzServicePrincipalToken, Update-AzServicePrincipal) - Add JWT assertion signing with X.509 certificate for cert-based SP auth (Build-JWTAssertion, Get-AzServicePrincipalCertificateToken, Update-AzServicePrincipalCertificate); supports cert store thumbprint and cross-platform PFX file loading - Add Azure CLI token acquisition via az account get-access-token (Get-AzCliToken, Update-AzCliToken) with mockable Invoke-AzCLICommand - Update Add-AuthenticationHTTPHeader with auto-refresh for new types - Update New-AzDoAuthenticationProvider with new parameter sets: ServicePrincipal, SecureStringServicePrincipal, Certificate, CertificateFile, AzureCLI - Update AzDevOpsDscResourceBase.Construct() to restore each new token type from serialized ModuleSettings.clixml - Add unit tests for all new classes and functions - Add integration tests for each auth method (skip if env vars absent) https://claude.ai/code/session_019ZwHAq4fwLyDgMU59mmDwd
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 (PR) description
This PR extends the authentication capabilities of AzureDevOpsDsc by adding support for three new authentication methods:
az account get-access-token)These methods complement the existing Personal Access Token and Managed Identity authentication options, providing more flexible authentication scenarios for Azure DevOps DSC in different environments.
Key Changes:
ServicePrincipalTokenandCertificateTokenclasses to represent and manage tokens from these authentication methods, with automatic expiration tracking and refresh capabilitiesGet-AzServicePrincipalToken- Acquires tokens using client credentialsGet-AzServicePrincipalCertificateToken- Acquires tokens using certificate-based JWT assertionsGet-AzCliToken- Acquires tokens via Azure CLIBuild-JWTAssertion- Constructs signed JWT assertions for certificate authenticationUpdate-AzServicePrincipal,Update-AzServicePrincipalCertificate, andUpdate-AzCliTokenfor automatic token refresh when expiredServicePrincipalandAzureCLItoken typesTesting:
This Pull Request (PR) fixes the following issues
None
Task list
https://claude.ai/code/session_019ZwHAq4fwLyDgMU59mmDwd