feat: add Microsoft Entra ID (passwordless) auth for the Azure Blob backend - #2802
Merged
Merged
Conversation
…ackend
sccache's Azure backend only supported connection-string (shared-key)
auth, which fails against storage accounts that disable shared-key
access. Add a passwordless path that authenticates with Microsoft Entra
ID (OAuth bearer tokens) instead.
* When no connection string is set, the Azblob operator is built with no
account key or SAS token, so OpenDAL/reqsign resolve credentials from
the ambient environment (service principal, workload identity, or a
managed identity via IMDS) and sign each request with a bearer token.
* The blob endpoint comes from SCCACHE_AZURE_ENDPOINT (validated as an
https URI; http is allowed only for a loopback host) or is synthesized
from SCCACHE_AZURE_STORAGE_ACCOUNT as
https://{account}.blob.core.windows.net.
* The connection-string path is unchanged, and the two auth modes are
mutually exclusive, enforced on both the env and file config surfaces.
Blank values from a file config are treated as absent.
* An explicit [cache.azure] block with no auth source errors clearly at
startup, whereas an ambient container env var with no auth source only
warns and disables the backend so it cannot take down an unrelated
cache.
Includes unit tests for endpoint resolution, auth-mode selection,
mutual exclusivity, endpoint/account validation, and config parsing
(env + TOML), plus documentation in docs/Azure.md and
docs/Configuration.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: babrekel <babrekel@microsoft.com>
babrekel
force-pushed
the
feat/azure-entra-id-auth
branch
from
August 10, 2026 21:16
c14afdc to
d8f47bd
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2802 +/- ##
==========================================
+ Coverage 72.90% 73.14% +0.23%
==========================================
Files 72 72
Lines 37275 37615 +340
==========================================
+ Hits 27176 27512 +336
- Misses 10099 10103 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
thanks! |
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.
Closes #1118.
Summary
sccache's Azure Blob backend currently supports only connection-string
(shared-key) authentication, which fails against storage accounts that have
shared-key access disabled — an increasingly common security baseline (and one
some Azure Policy configurations mandate).
This adds a Microsoft Entra ID (passwordless) path: when no connection
string is configured, the Azblob operator is built without an account key or
SAS token, so OpenDAL (via its
reqsigndependency) resolves an Entracredential from the ambient environment and signs each request with an OAuth
bearer token.
Behavior
Shared key (unchanged):
SCCACHE_AZURE_CONNECTION_STRINGkeeps itsexisting behavior, byte-for-byte.
Entra ID (new): with no connection string, select the account via either
SCCACHE_AZURE_STORAGE_ACCOUNT— endpoint synthesized ashttps://{account}.blob.core.windows.net, orSCCACHE_AZURE_ENDPOINT— a full endpoint for sovereign clouds / customDNS, validated as an
httpsURI (plainhttpaccepted only for a loopbackhost).
Credentials then resolve from the environment: a service principal
(
AZURE_TENANT_ID/AZURE_CLIENT_ID/AZURE_CLIENT_SECRET), workloadidentity (
AZURE_FEDERATED_TOKEN_FILE), or a managed identity via IMDS.The two modes are mutually exclusive, enforced on both the env and
file-config surfaces; blank values from a file config are treated as absent.
A container configured with no auth source: an ambient env var only warns and
disables the backend (so a stray variable can't take down an unrelated cache),
whereas an explicit
[cache.azure]block errors clearly at startup.No new dependencies —
opendal/services-azblobandreqsignare already pulledin by the existing
azurefeature.Testing
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo check --no-default-features(with and without--features azure), andcargo test --features azureall pass.https+ host-injection validation, empty-string normalization, auth-modeselection, mutual exclusivity (both operands), the no-auth error, and config
parsing across the env and TOML surfaces.
without a live account; a key-less
Azblobbuild is confirmed to engagereqsign's OAuth loader chain rather than going anonymous. In practice this
path has been running as the compilation-cache backend for a CI fleet,
authenticating to Azure Blob Storage via workload identity
(
AZURE_FEDERATED_TOKEN_FILE).Docs
docs/Azure.mdanddocs/Configuration.mdare updated with the new variables,precedence, mutual exclusivity, the
https/loopback rule, and an Azurite note.