[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4

Authentication & Credentials

💻 The Foundry SDK 6 min 60 BASE XP

Securing SDK Access

The SDK uses DefaultAzureCredential from the Azure Identity library, which automatically tries multiple authentication methods:

Authentication Chain

  1. Environment variables (AZURE_CLIENT_ID, etc.) — for CI/CD
  2. Managed Identity — for Azure-hosted apps (VMs, App Service)
  3. Azure CLI (az login) — for local development
  4. VS Code / Azure PowerShell — additional dev options

Best Practices

EnvironmentUseWhy
Local DevAzure CLI (az login)Simple, no secrets to manage
ProductionManaged IdentityNo credentials in code, auto-rotated
CI/CDService Principal + Environment varsAutomated, scoped permissions
🚧 Important: Never hardcode API keys in your application code. Always use DefaultAzureCredential or Managed Identity. API keys should only be used for quick prototyping and testing.
FOUNDRY VERIFICATION
QUERY 1 // 1
What authentication method should you use for production Azure AI Foundry applications?
Hardcoded API keys
Managed Identity
Username and password
Anonymous access
Watch: 139x Rust Speedup
Authentication & Credentials | The Foundry SDK — Azure Foundry Academy