CasCap.Api.Azure.Auth 1.6.4

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package CasCap.Api.Azure.Auth --version 1.6.4
                    
NuGet\Install-Package CasCap.Api.Azure.Auth -Version 1.6.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CasCap.Api.Azure.Auth" Version="1.6.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CasCap.Api.Azure.Auth" Version="1.6.4" />
                    
Directory.Packages.props
<PackageReference Include="CasCap.Api.Azure.Auth" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CasCap.Api.Azure.Auth --version 1.6.4
                    
#r "nuget: CasCap.Api.Azure.Auth, 1.6.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CasCap.Api.Azure.Auth@1.6.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CasCap.Api.Azure.Auth&version=1.6.4
                    
Install as a Cake Addin
#tool nuget:?package=CasCap.Api.Azure.Auth&version=1.6.4
                    
Install as a Cake Tool

CasCap.Api.Azure.Auth

Azure authentication helpers that give applications one configuration model and credential factory across development, Edge, and Azure-hosted environments:

  • Developer workstations can load a client certificate from the current user's certificate store, a combined PEM file, or a PFX file.
  • Edge and self-managed deployments can mount one combined PEM or PFX client certificate without requiring Azure Arc, cluster membership in Entra ID, or a cloud-managed node identity.
  • Azure-hosted Kubernetes workloads can use federated workload identity. The library detects the injected Azure environment and creates a WorkloadIdentityCredential without a certificate or client secret.
  • Local or disconnected environments can disable Key Vault integration explicitly and use other configuration providers.

Every enabled path produces an Azure SDK TokenCredential, so the application can use the same startup and dependency-injection flow for Key Vault, Storage, Event Hubs, Service Bus, and other token-aware Azure clients.

flowchart LR
    DEV["Developer workstation"] --> STORE["Certificate store"]
    DEV --> FILE["Combined PEM or PFX"]
    EDGE["Edge / self-managed"] --> FILE
    AZURE["Azure-hosted Kubernetes"] --> FEDERATED["Federated service-account token"]

    STORE --> CLIENT_CERT["ClientCertificateCredential"]
    FILE --> CLIENT_CERT
    FEDERATED --> WORKLOAD["WorkloadIdentityCredential"]

    CLIENT_CERT --> SDK["Azure SDK clients"]
    WORKLOAD --> SDK

Installation

dotnet add package CasCap.Api.Azure.Auth

Target frameworks: net8.0, net9.0, net10.0

Services / Extensions

Type Name Description
Interface IAzureAuthConfig Exposes Azure authentication configuration: Key Vault name/URI, Entra ID tenant/application IDs, certificate thumbprint, combined PEM path, or PFX path/password, and a lazily-resolved TokenCredential. Provides IsKeyVaultEnabled to allow Key Vault-free operation.
Static factory TokenCredentialExtensions Creates WorkloadIdentityCredential from injected Kubernetes workload-identity environment variables, or ClientCertificateCredential from one configured certificate source.

Key Methods

  • TokenCredentialExtensions.IsPodManagedIdentity — Checks whether the current pod is using Azure workload identity (federated tokens).
  • TokenCredentialExtensions.CreateTokenCredential(IAzureAuthConfig) — Creates a WorkloadIdentityCredential when the Kubernetes workload-identity environment is present; otherwise creates a ClientCertificateCredential from the configured certificate source, or returns null.

Configuration

Class Section Properties
AzureAuthConfig AppConfig KeyVaultName (required), IsKeyVaultEnabled (computed), AzureEntraPodManagedIdentityClientId, AzureEntraTenantId, AzureEntraApplicationId, AzureEntraCertThumbprint, AzureEntraPemPath, AzureEntraPfxPath, AzureEntraPfxPassword

AzureAuthConfig implements both IAppConfig and IAzureAuthConfig. The TokenCredential property is lazily created from the certificate properties via TokenCredentialExtensions.

Azure workload identity is selected when AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_FEDERATED_TOKEN_FILE, and AZURE_AUTHORITY_HOST are all present. The injected AZURE_CLIENT_ID is used by default; AzureEntraPodManagedIdentityClientId can explicitly select a different registered client ID. Certificate configuration is ignored in this environment because workload identity has priority.

Configure exactly one certificate source. Supplying more than one fails explicitly rather than silently selecting one:

  • AzureEntraCertThumbprint selects a certificate from the current user's certificate store.
  • AzureEntraPemPath loads one combined PEM file containing the certificate and private key. This is the preferred format when the same credential is also consumed by External Secrets Operator.
  • AzureEntraPfxPath loads a PKCS#12/PFX file, with AzureEntraPfxPassword when it is protected.

PEM and PFX are alternative representations, not files to deploy together.

Developer Certificate Selection

For workstation development, install the certificate and private key into the current user's Personal certificate store and keep AzureEntraCertThumbprint in the application's user-secrets store. Each repository can have a different UserSecretsId, so rotating one shared certificate requires updating every consuming repository's secrets.json.

Do not place workstation thumbprints or paths in tracked configuration. Also remove deployment-only PEM/PFX path values from local providers loaded on the workstation: configuring a thumbprint and a file path together fails explicitly instead of silently selecting one.

Running Without Key Vault

Set KeyVaultName to "skip" (case-insensitive) to disable Key Vault integration entirely. When IsKeyVaultEnabled returns false:

  • The application skips adding Azure Key Vault as a configuration source at startup.
  • TokenCredential is not resolved (no certificate lookup is attempted).
  • Secrets must be supplied via alternative configuration sources (environment variables, user secrets, or appsettings.json).
  • Sink services that use StorageExtensions.CreateTableClient() automatically fall back to connection strings when the connection string contains ; (e.g. Azurite emulator).

Override via any configuration source:

  • Environment variable: AppConfig__KeyVaultName=skip
  • User secrets: { "AppConfig": { "KeyVaultName": "skip" } }
  • appsettings override: same JSON shape

Credential Resolution

Credential Resolution Priority:

  1. Skip sentinel — KeyVaultName = "skip" → null (no credential, no Key Vault)
  2. Azure Workload Identity (Kubernetes pod with federated token) — auto-detected
  3. Certificate thumbprint — searches LocalMachine\My certificate store
  4. Combined PEM file — loads the certificate and private key from one file
  5. PFX file — loads certificate from path with optional password
  6. null — no credential available

Certificate source configuration is mutually exclusive; the numbered list documents supported sources, not fallback precedence between simultaneously configured values.

Dependencies

NuGet Packages

Package
Azure.Identity
CasCap.Common.Abstractions
CasCap.Common.Extensions
CasCap.Common.Logging

Project References

None.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on CasCap.Api.Azure.Auth:

Package Downloads
CasCap.Api.DoorBird.Sinks

Pluggable event sink implementations (Redis, Azure Tables, Azure Blob Storage) for the CasCap.Api.DoorBird door station integration library.

CasCap.Api.Buderus.Sinks

Pluggable event sink implementations (Redis, Azure Tables) for the CasCap.Api.Buderus heating integration library.

CasCap.Api.Fronius.Sinks

Pluggable event sink implementations (Redis, Azure Tables) for the CasCap.Api.Fronius solar inverter integration library.

CasCap.Api.Knx.Sinks

Pluggable event sink implementations (Redis, Azure Tables) for the CasCap.Api.Knx building automation integration library.

CasCap.Api.Voice

Provider-neutral speech-to-text and text-to-speech components for .NET applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 358 11/14/2026
2.0.0 457 11/5/2026
1.8.0 223 11/1/2026
1.7.1 370 10/24/2026
1.7.0 263 10/21/2026
1.6.4 201 10/4/2026
1.6.3 262 9/25/2026
1.6.2 224 9/23/2026
1.6.1 154 9/21/2026
1.6.0 307 9/19/2026
1.5.5 225 9/11/2026
1.5.4 141 9/1/2026
1.5.3 230 8/18/2026
1.5.2 242 7/15/2026
1.5.1 249 6/26/2026
1.5.0 333 6/12/2026
1.4.13 241 6/10/2026
1.4.12 262 5/27/2026
1.4.11 245 5/26/2026
1.4.10 199 5/21/2026
Loading failed