Conversation
- Created a new .NET project for testing Azure credential forwarding. - Added comprehensive documentation for Azure Credential Forwarding in Docker, including quick start guides, architecture, supported scenarios, and troubleshooting steps. - Included code examples for .NET, Python, and Node.js demonstrating the use of DefaultAzureCredential with credential forwarding.
|
🚀 Website Preview
Preview has been cleaned up as the PR was closed. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #131 +/- ##
==========================================
- Coverage 55.33% 55.13% -0.20%
==========================================
Files 157 158 +1
Lines 23735 23903 +168
==========================================
+ Hits 13133 13180 +47
- Misses 9781 9899 +118
- Partials 821 824 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
🚀 Test This PRA preview build ( 🌐 Website PreviewLive Preview: https://jongio.github.io/azd-app/pr/131/ One-Line Install (Recommended)PowerShell (Windows): iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.ps1) } -PrNumber 131 -Version 0.11.7-pr131"Bash (macOS/Linux): curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.sh | bash -s 131 0.11.7-pr131UninstallWhen you're done testing: PowerShell (Windows): iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.ps1) } -PrNumber 131"Bash (macOS/Linux): curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.sh | bash -s 131Build Info:
What to Test: |
🧪 How to Test This PR LocallyPrerequisites
No other tooling is needed — the auth shim binary is pre-compiled and embedded in the CLI. 1. Install the PR buildUse the install commands from the comment above to install version 2. Run the test projectThis repo includes a ready-to-go test project at cd cli/tests/projects/integration/container-auth-test
azd app run3. Test the endpointsIn another terminal:
What you should expect
If you don't have Azure credentialsYou can still verify the injection mechanics without being logged in: curl http://localhost:8080/checkThe How to enable this for your own projectAdd services:
myapp:
host: containerapp
image: mcr.microsoft.com/dotnet/sdk:8.0
local:
credentials: azdThat single line enables credential forwarding for any containerized service. |
…ing auth shim binaries
The bin/ directory was not tracked in git, causing the all:bin go:embed pattern to fail with 'no matching files found' during CI builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Enables
DefaultAzureCredentialto work inside Docker containers during local development. This solves a long-standing pain point (azure-sdk-for-net#19167) where Azure SDKs cannot authenticate from within containers because there are no credentials available in the container environment.How it works
When
local.credentials: azdis set inazure.yaml, azd automatically:azd auth tokenazdand volume-mounts it into the container at/usr/local/bin/azd/run/secrets/azd-auth/Inside the container,
DefaultAzureCredential→AzureDeveloperCliCredentialcallsazd auth token, which hits the shim. The shim forwards the request over mTLS to the host, retrieves a real token, and returns it — all transparently to application code.No code changes required — any Azure SDK (.NET, Python, Node.js, Java, Go) that supports
AzureDeveloperCliCredentialworks automatically.Security model
https://prefix required, max 512 bytes, shell metacharacters blockedChanges
Core feature (
cli/src/internal/)containerauth/build.go— Cross-compiles the shim binary for the container's architecture (amd64/arm64)containerauth/shim/main.go— The shim binary that runs inside containers; validates scopes, makes mTLS requests to hostservice/orchestrator.go— Auth server lifecycle management with cleanup-on-errorservice/container_runner.go— Volume mounts and extra hosts injection when auth is enabledservice/types.go—LocalServiceConfigwithCredentialsfield,IsContainerAuthEnabled()helperdocker/exec.go+docker/types.go— Container architecture detection for cross-compilationcmd/app/commands/run.go— Graceful shutdown ordering (services → auth server)Schema
schemas/v1.1/azure.yaml.json— Addedcredentialsenum underlocalconfigDocumentation (
web/src/pages/)reference/credential-forwarding.astro— Detailed reference page with architecture diagram, SDK support table, security model, and troubleshootingindex.astro— Homepage feature cardreference/containers.astro— Credential forwarding sectionreference/azure-yaml.astro—local.credentialsconfig referenceTesting
containerauth/build_test.go— Architecture detection, host detection, extra hostsdocker/client_test.go— Container inspect parsingcontainer-auth-test/— Full integration test suite:test.ps1— Automated E2E test (start server, run container, verify token retrieval)pentest/main.go— 19-attack automated penetration testpentest/heist.go— Proof-of-concept demonstrating accepted risk (in-container token access)Maintenance
go.modfiles to Go 1.25.7azd-coredependency to v0.4.2Companion PR
The mTLS server, certificate generation, and token provider live in azd-core: jongio/azd-core#11
Testing
containerauth/(arch detection, host detection, extra hosts, shim source)azd-core/authn/(certs, server, token validation)mage preflightpasses (vet, staticcheck, govulncheck, build, tests)