
Call Claude with Your Azure Credentials: Microsoft Foundry Setup in 5 Minutes
Chris Harper
2 min read
Jul 3, 2026 · 04:04 UTC
TL;DR: Claude Opus 4.8, Haiku 4.5, and Sonnet 5 are generally available in Microsoft Foundry — Azure shops can now call them via Entra ID with no separate Anthropic contract.
Previously, calling Claude from an Azure workload meant a separate Anthropic API key, separate billing, and routing traffic outside your Azure perimeter. With the Microsoft Foundry GA (June 29), that changes: deploy Claude once via the Foundry portal, then call it with your existing Azure identity, inside your Azure network, on your existing invoice.
What's included at GA
- Claude Opus 4.8 and Haiku 4.5 on Azure infrastructure (East US2, Sweden Central); Sonnet 5 via Global Standard
- Opus 4.8 also supports US Data Zone Standard for data-residency requirements
- Microsoft Enterprise Agreement drawdown, Entra ID auth, VNet integration
- Full Anthropic Messages API parity: prompt caching, extended thinking, streaming
Setup
pip install "anthropic" "azure-identity"
In the Foundry portal (ai.azure.com): Discover → Models → pick your Claude model → Deploy → Custom settings → accept Azure Marketplace terms. Note your resource name and deployment name from the Details tab.
Keyless auth with Entra ID (recommended for production)
from anthropic import AnthropicFoundry
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
client = AnthropicFoundry(
azure_ad_token_provider=get_bearer_token_provider(
DefaultAzureCredential(),
"https://ai.cognitiveservices.com/.default"
),
base_url="https://<resource-name>.services.ai.azure.com/anthropic"
)
msg = client.messages.create(
model="claude-sonnet-4-6", # use your deployment name
messages=[{"role": "user", "content": "Summarize this PR diff: ..."}],
max_tokens=1024
)
print(msg.content)
DefaultAzureCredential picks up az login locally and managed identity in production — no credential rotation to manage.
Wire Claude Code to your Foundry endpoint
export ANTHROPIC_BASE_URL="https://<resource-name>.services.ai.azure.com/anthropic"
export AZURE_AUTH_TOKEN="$(az account get-access-token \
--resource https://ai.cognitiveservices.com --query accessToken -o tsv)"
claude --model claude-sonnet-4-6
For the fastest path, the Claude on Foundry starter kit provisions the whole stack with azd up.
Sources: Claude in Microsoft Foundry — Anthropic Blog · Deploy and use Claude in Microsoft Foundry — Microsoft Learn · Claude on Foundry starter kit — GitHub