Skip to content

Auth Task Group 5: Azure Authentication Provider #116

Closed

Description

@slin1237

Auth Task Group 5: Azure Authentication Provider

Overview

Implement comprehensive Microsoft Azure authentication support including Service Principals, Managed Identities, Azure CLI, and various Azure-specific authentication methods.

Tasks

Task 5.1: Create Azure Authentication Factory

Status: Completed

Description: Implement the Azure-specific authentication factory that integrates with the core authentication framework. This factory will handle Azure-specific configuration and credential instantiation.

Time Estimate: 1 day
Dependencies: Core Framework (Task Group 1)

Deliverables:

  • pkg/auth/azure/factory.go with Factory implementation
  • Registration handled externally
  • Azure-specific configuration types

Implementation Status:

  • Factory struct with Create() and SupportedAuthTypes()
  • Supports ClientSecret, ClientCertificate, ManagedIdentity, DeviceFlow, Default, AccountKey
  • Configuration extraction from auth.Config.Extra
  • Integration with Azure SDK for Go v2
  • Tenant ID and Client ID management

Acceptance Criteria:

  • Factory identifies Azure auth types
  • Validates provider type
  • Handles tenant ID from config
  • Cloud environment via SDK options
  • Unit tests implemented

Task 5.2: Implement Service Principal with Secret

Status: Completed

Description: Implement authentication using Azure Active Directory service principals with client secrets. This is the most common authentication method for applications.

Time Estimate: 2 days
Dependencies: Task 5.1

Deliverables:

  • Client secret logic in factory.go
  • ClientSecretConfig struct in credentials.go
  • Azure SDK handles OAuth2 flows

Implementation Status:

  • ClientSecretConfig with validation
  • Environment variable support (AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET)
  • Uses azidentity.NewClientSecretCredential
  • Azure SDK handles OAuth2 flow
  • SDK manages token lifecycle
  • Automatic token caching by SDK

Acceptance Criteria:

  • Authenticates with client ID/secret
  • SDK implements OAuth2 flow
  • SDK handles AD endpoints
  • Custom audiences via scopes
  • SDK manages refresh
  • SDK caches tokens
  • Validates IDs
  • Unit tests implemented
  • Integration tests need Azure setup

Task 5.3: Implement Service Principal with Certificate

Status: Completed

Description: Implement certificate-based authentication for service principals, providing higher security than client secrets.

Time Estimate: 3 days
Dependencies: Task 5.1, Task 5.2

Deliverables:

  • Certificate auth logic in factory.go
  • ClientCertificateConfig in credentials.go
  • Azure SDK handles JWT creation

Implementation Status:

  • ClientCertificateConfig with validation
  • Certificate path and password support
  • Environment variable support
  • Uses azidentity.NewClientCertificateCredential
  • SDK loads certificates
  • SDK handles PKCS#12/PEM
  • SDK creates JWT assertions

Acceptance Criteria:

  • Loads from files via SDK
  • SDK supports formats
  • SDK creates JWT
  • Password protection supported
  • SDK validates expiry
  • SDK calculates thumbprint
  • Rotation via new creds
  • Unit tests implemented
  • Integration tests need certs

Task 5.4: Implement System-Assigned Managed Identity

Status: Completed

Description: Implement authentication using system-assigned managed identities for Azure resources. This enables password-free authentication for Azure VMs and other resources.

Time Estimate: 2 days
Dependencies: Task 5.1

Deliverables:

  • Managed identity logic in factory.go
  • ManagedIdentityConfig in credentials.go
  • Azure SDK handles IMDS

Implementation Status:

  • ManagedIdentityConfig for user-assigned
  • Client ID support for user-assigned
  • Uses azidentity.NewManagedIdentityCredential
  • SDK detects Azure environment
  • SDK handles IMDS communication
  • SDK manages API versions
  • SDK implements retries

Acceptance Criteria:

  • SDK detects environment
  • SDK retrieves tokens
  • SDK handles versions
  • SDK retry logic
  • Custom scopes supported
  • Validates IMDS responses
  • Handles identity not assigned errors
  • Unit tests with mocked IMDS
  • Integration tests on Azure VM

Task 5.5: Implement User-Assigned Managed Identity

Status: In Progress

Description: Extend managed identity support to handle user-assigned identities with explicit identity selection.

Time Estimate: 2 days
Dependencies: Task 5.4

Deliverables:

  • Extended managed identity support
  • Identity selection logic
  • Multiple identity handling

Acceptance Criteria:

  • Supports client ID selection
  • Supports object ID selection
  • Supports resource ID selection
  • Lists available identities
  • Handles multiple assigned identities
  • Clear errors for identity not found
  • Validates identity formats
  • Unit tests for identity selection
  • Integration tests with user-assigned identity

Task 5.6: Implement Azure CLI Authentication

Status: Pending

Description: Integrate with Azure CLI credentials, allowing applications to use the same authentication as the az command-line tool.

Time Estimate: 2 days
Dependencies: Task 5.1

Deliverables:

  • pkg/auth/azure/cli.go with CLI integration
  • Token retrieval from az CLI
  • Subscription context handling

Acceptance Criteria:

  • Detects az CLI installation
  • Retrieves tokens using az account get-access-token
  • Handles multiple subscriptions
  • Supports tenant selection
  • Refreshes tokens automatically
  • Handles CLI not logged in errors
  • Validates CLI version compatibility
  • Unit tests with mocked CLI
  • Integration tests with az CLI

Task 5.7: Implement Azure Arc Managed Identity

Status: Pending

Description: Add support for Azure Arc-enabled servers to use managed identity authentication outside of Azure.

Time Estimate: 2 days
Dependencies: Task 5.4

Deliverables:

  • pkg/auth/azure/arc.go with Arc support
  • HIMDS endpoint handling
  • Challenge-response authentication

Acceptance Criteria:

  • Detects Arc-enabled environment
  • Handles HIMDS authentication challenge
  • Retrieves tokens from Arc IMDS
  • Validates Arc certificates
  • Supports both Windows and Linux
  • Handles Arc-specific errors
  • Unit tests with mocked HIMDS
  • Integration tests on Arc-enabled server

Task 5.8: Implement Azure Kubernetes Service Pod Identity

Status: Pending

Description: Implement authentication for AKS pods using Azure AD pod identity or workload identity.

Time Estimate: 3 days
Dependencies: Task 5.1

Deliverables:

  • pkg/auth/azure/pod_identity.go with implementation
  • NMI endpoint communication
  • Workload identity support

Acceptance Criteria:

  • Supports AAD Pod Identity v1
  • Supports Workload Identity (preview)
  • Communicates with NMI endpoint
  • Handles pod identity binding
  • Supports federated credentials
  • Manages token lifecycle
  • Unit tests with mocked endpoints
  • Integration tests in AKS cluster

Task 5.9: Create Azure Credential Chain

Status: Pending

Description: Implement the Azure credential chain following DefaultAzureCredential behavior from Azure SDK.

Time Estimate: 1 day
Dependencies: Tasks 5.2-5.8

Deliverables:

  • pkg/auth/azure/chain.go with credential chain
  • Configurable precedence
  • Error aggregation

Acceptance Criteria:

  • Matches Azure SDK DefaultAzureCredential order
  • Environment → Managed Identity → Azure CLI → etc.
  • Allows custom ordering
  • Caches successful methods
  • Detailed error reporting
  • Performance optimizations
  • Unit tests for all scenarios
  • Benchmark comparisons with SDK

Task 5.10: Add Multi-Tenant Authentication Support

Status: Pending

Description: Implement support for multi-tenant applications that can authenticate across multiple Azure AD tenants.

Time Estimate: 2 days
Dependencies: Task 5.2, Task 5.3

Deliverables:

  • Multi-tenant configuration support
  • Tenant discovery logic
  • Cross-tenant token handling

Acceptance Criteria:

  • Supports multi-tenant app registrations
  • Handles tenant-specific tokens
  • Validates allowed tenant lists
  • Supports tenant discovery
  • Manages per-tenant token caches
  • Clear tenant selection APIs
  • Unit tests for multi-tenant scenarios
  • Integration tests across tenants

Summary

Total Time Estimate: 20 days
Current Status: Core Azure authentication implemented via Azure SDK for Go

Completed Deliverables:

  • Azure authentication factory
  • Service Principal with client secret
  • Service Principal with certificate
  • Managed Identity (system and user-assigned)
  • Device flow authentication
  • Default credential chain
  • Storage account key authentication

Pending Deliverables:

  • Azure CLI integration
  • Federated identity credentials
  • Key Vault certificate provider
  • Multi-tenant authentication
  • Azure Stack support
  • Custom cloud environments

Success Metrics Achieved:

  • Uses Azure Identity SDK
  • Supports core Azure services
  • Managed identity works
  • Basic SDK error messages
  • Performance via SDK

Activity

  1. added
    enhancement
    auth
    on Jul 1, 2025
  2. self-assigned this
    on Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

authenhancementfeaturemulti-cloud

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions