Skip to content

feat(azure): add OIDC/Workload Identity Federation authentication support#11389

Open
mdoukan wants to merge 1 commit into
prowler-cloud:masterfrom
mdoukan:master
Open

feat(azure): add OIDC/Workload Identity Federation authentication support#11389
mdoukan wants to merge 1 commit into
prowler-cloud:masterfrom
mdoukan:master

Conversation

@mdoukan
Copy link
Copy Markdown

@mdoukan mdoukan commented May 29, 2026

Description

This PR implements Azure OIDC (Workload Identity Federation) authentication support, resolving #11386.

The Azure provider previously only supported static AZURE_CLIENT_SECRET. In production environments where static secrets are prohibited by security policy, Prowler was unusable. This PR adds a new --oidc-auth mode using short-lived JWT tokens.

Changes

  • arguments.py: Add --oidc-auth CLI flag as a new mutually exclusive authentication mode
  • exceptions.py: Add AzureOIDCTokenMissingError exception (error code 2024)
  • azure_provider.py:
    • Add oidc_auth parameter to __init__, validate_arguments, setup_session, setup_identity, test_connection
    • Add check_oidc_creds_env_vars() static method
    • Use ClientAssertionCredential with a lazy token callback (reads AZURE_FEDERATED_TOKEN, falling back to AZURE_OIDC_TOKEN)
    • Identity type reported as Service Principal (OIDC)
  • tests/providers/azure/azure_provider_test.py: Add TestAzureProviderOIDCAuth class with 7 unit tests

Usage

export AZURE_CLIENT_ID="00000000-0000-0000-0000-000000000000"
export AZURE_TENANT_ID="00000000-0000-0000-0000-000000000000"
export AZURE_FEDERATED_TOKEN="eyJra..."  # or AZURE_OIDC_TOKEN

prowler azure --oidc-auth

Notes

  • No new dependencies required — ClientAssertionCredential is already part of azure-identity
  • The existing --sp-env-auth mode is unchanged
  • Token is read lazily on each credential refresh, supporting short-lived OIDC tokens

Closes #11386

…port

Implements Azure provider support for OIDC (Workload Identity Federation)
authentication, enabling Prowler to run in security-strict production
environments where static client secrets are prohibited.

Closes prowler-cloud#11386

Changes:
- Add --oidc-auth CLI flag as a new mutually exclusive authentication mode
- Add AzureOIDCTokenMissingError exception (code: 2024) for missing env vars
- Add check_oidc_creds_env_vars() static method to validate required env vars
- Add oidc_auth parameter to __init__, validate_arguments, setup_session,
  setup_identity and test_connection methods
- Use ClientAssertionCredential with a lazy token callback that reads
  AZURE_FEDERATED_TOKEN (falling back to AZURE_OIDC_TOKEN) at runtime
- Identity type reported as 'Service Principal (OIDC)' for OIDC sessions
- Add TestAzureProviderOIDCAuth test class with 7 unit tests covering
  missing env vars, token fallback, successful session setup and
  test_connection flow

Usage:
  export AZURE_CLIENT_ID="..."
  export AZURE_TENANT_ID="..."
  export AZURE_FEDERATED_TOKEN="eyJra..."  # or AZURE_OIDC_TOKEN
  prowler azure --oidc-auth
@mdoukan mdoukan requested a review from a team as a code owner May 29, 2026 09:30
@github-actions github-actions Bot added the provider/azure Issues/PRs related with the Azure provider label May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions github-actions Bot added the community Opened by the Community label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Opened by the Community provider/azure Issues/PRs related with the Azure provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Workload Identity Federation (OIDC) authentication for Azure provider

1 participant