Claude in Microsoft Foundry
Access Claude models through Microsoft Foundry with Azure-native endpoints and authentication.
This guide shows you how to set up Claude in Microsoft Foundry and make API calls to it. You can use one of Anthropic’s client SDKs or direct HTTP requests. When you access Claude in Microsoft Foundry, you pay for Claude usage through the Azure Marketplace. API model IDs and deployments lists the available models. Features such as the 1M-token context window are also available. You manage costs through your Azure subscription.
Claude is available in Global Standard and US Data Zone Standard deployment types in Foundry resources, billed in Claude Consumption Units through the Azure Marketplace. Visit Claude in Microsoft Foundry pricing for details.
Hosting options
Claude models in Microsoft Foundry are available in two hosting options. You choose the hosting option when you configure the deployment.
| Hosted on Azure | Hosted on Anthropic | |
|---|---|---|
| Where inference runs | Anthropic-operated service running on Azure infrastructure | Anthropic-operated service running on Anthropic infrastructure |
| Model availability | Some Opus, Sonnet, and Haiku models | All Claude models available on Microsoft Foundry |
| Deployment types | Global Standard, US Data Zone Standard | Global Standard |
| Recommended for | Most workloads | Workloads that need models hosted only on Anthropic or features available only when hosted on Anthropic |
For deployments hosted on Azure, Anthropic processes prompts and completions on Azure infrastructure and stores retained content there. Retained content includes content flagged by Anthropic’s safety systems for Anthropic to review. Operational data that contains no prompts or completions is stored on Anthropic’s systems outside Azure. Examples include safety classifier scores, identifiers, and usage and billing data.
Prerequisites
Before you start, ensure you have:
- An active Azure subscription
- Access to the Foundry portal
- An Azure role-based access control (RBAC) role, such as Foundry User or Cognitive Services User, for the Foundry resource that you create in Provisioning
- Optional: the Azure CLI to get Microsoft Entra ID tokens with
az account get-access-token
Install an SDK
Anthropic’s client SDKs support Foundry through a platform-specific package or client class. The examples on this page also show requests with cURL and the ant CLI. To set up the CLI, see CLI quickstart.
pip install -U "anthropic"
# For Entra ID authentication, also install the Azure Identity library
pip install azure-identityProvisioning
Foundry uses a two-level hierarchy: resources contain your security and billing configuration, whereas deployments are the model instances you call through the API. You’ll first create a Foundry resource, then create one or more Claude deployments within it.
Provisioning Foundry resources
To provision your resource:
- Navigate to the Foundry portal.
- Create or select a Foundry resource in an Azure region where your model is available. You can follow Microsoft’s instructions for creating a Foundry resource or create a Foundry project, which creates a resource for you.
- Note your resource name, which is
{resource}in API endpoints such ashttps://{resource}.services.ai.azure.com/anthropic/v1/*.
To restrict network access, you can add your resource to a private network (Azure Virtual Network).
Creating Foundry deployments
After creating your resource, deploy a Claude model to make it available for API calls. These steps describe the new Foundry portal (the New Foundry toggle is on):
- Sign in to the Foundry portal. From the portal homepage, select Discover in the upper-right navigation, then Models in the left pane to open the model catalog.
- Search for and select a Claude model (for example,
claude-opus-5-5). Each model appears once in the catalog regardless of how many hosting options it supports. - On the model card, select Deploy, then Custom settings to open the deployment settings pane. If you select Default settings instead, the deployment is automatically configured as Hosted on Azure for models available in both hosting options.
- On your first Claude deployment, review the Azure Marketplace terms, select an industry, and select Agree and Proceed to accept the terms and subscribe to the Azure Marketplace offer.
- Configure the deployment:
- Deployment name: Defaults to the model ID, but you can customize it (for example,
my-claude-deployment). The deployment name cannot be changed after creation. - Model version: This setting determines the hosting option. Expand Model version settings, open the Model version dropdown menu, and select the version labeled with the hosting option that you want.
- Region scope: Select Global, or Data Zone if the deployment is hosted on Azure. Data Zone creates a US Data Zone Standard deployment, which keeps inference within the United States. For pricing, see Inference geography.
- Deployment name: Defaults to the model ID, but you can customize it (for example,
- Select Deploy and wait for provisioning to complete.
- Once deployed, select Build in the upper-right navigation, then Models in the left pane, and open your deployment. The Details tab shows the Target URI (your endpoint URL) and Key (your API key).
If the New Foundry toggle is off, you are in the classic portal layout. There, open Model catalog in the left pane to find and deploy a model, and open Models + endpoints (under My assets) to view your deployments and their endpoint details.
Authentication
Claude in Microsoft Foundry supports two authentication methods: API keys and Entra ID tokens. Both methods use endpoints in the format https://{resource}.services.ai.azure.com/anthropic/v1/*. For Claude Mythos models, use Entra ID tokens.
API key authentication
After provisioning your Foundry Claude resource, you can obtain an API key from the Foundry portal:
- In the Foundry portal, select Build in the upper-right navigation, then Models in the left pane.
- Open your Claude deployment and select the Details tab.
- Copy the Key value (and note the Target URI for your endpoint).
- Use either the
api-keyorx-api-keyheader in your requests, or provide it to the SDK.
The SDK’s Foundry client requires an API key and either a resource name or base URL, and automatically reads them from the following environment variables if they are defined:
ANTHROPIC_FOUNDRY_API_KEY- Your API keyANTHROPIC_FOUNDRY_RESOURCE- Your resource name (for example,example-resource)ANTHROPIC_FOUNDRY_BASE_URL- Alternative to resource name in every SDK except C#: the full base URL (for example,https://example-resource.services.ai.azure.com/anthropic/)
Example using API key:
import os
from anthropic import AnthropicFoundry
client = AnthropicFoundry(
api_key=os.environ.get("ANTHROPIC_FOUNDRY_API_KEY"),
resource="example-resource", # your resource name
)
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content)Microsoft Entra authentication
Entra ID authentication lets you manage access with Azure RBAC, integrate with your organization’s identity management, and avoid handling API keys manually. To use Entra ID tokens:
- Enable Microsoft Entra ID authentication for your Foundry resource.
- Obtain an access token from Entra ID.
- Use the token in the
Authorization: Bearer {TOKEN}header.
Example using Entra ID:
from anthropic import AnthropicFoundry
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
# Get Microsoft Entra ID token using token provider pattern
token_provider = get_bearer_token_provider(
DefaultAzureCredential(), "https://ai.azure.com/.default"
)
# Create client with Entra ID authentication
client = AnthropicFoundry(
resource="example-resource", # your resource name
azure_ad_token_provider=token_provider, # Use token provider for Entra ID auth
)
# Make request
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content)Correlation request IDs
Foundry includes request identifiers in HTTP response headers for debugging and tracing. When contacting support, provide both the request-id and apim-request-id (Azure API Management) values to help teams quickly locate and investigate your request across both Anthropic and Azure systems.
Feature support
Claude in Microsoft Foundry supports most Claude features. Features overview lists Claude’s features, and the Availability section of a feature’s page shows whether Foundry supports it and with which hosting option.
Context window
All available models have a 1M-token context window on Microsoft Foundry except Claude Opus 4.5, Claude Sonnet 4.5 (deprecated), and Claude Haiku 4.5. These three models have a 200k-token context window.
Claude features not supported for Claude in Microsoft Foundry
- Admin API
- Advisor tool
- Claude Managed Agents
- Compliance API
- Models API
- Message Batches API
- Server-side fallback (the
fallbacksparameter; use the client-side fallback pattern instead) - User profile endpoints (
/v1/user_profiles; create profiles on the Claude API instead)
Additional features not supported when hosted on Azure
The following features are available for deployments hosted on Anthropic but are not supported for deployments hosted on Azure:
- Code execution
- Web search and web fetch tool versions later than
web_search_20250305andweb_fetch_20250910. Deployments hosted on Azure support only these basic versions, so dynamic filtering, response inclusion, and cache bypass are not available. - Agent Skills
- Programmatic tool calling
- Files API
Requests that use these features against a deployment hosted on Azure return a 400 Bad Request error by design. Claude Code detects deployments hosted on Azure and automatically adapts its feature set.
API responses
API responses from Claude in Microsoft Foundry follow the standard Claude API response formatPreview with links to the API reference available — press Tab until focus enters the card, Escape to return., including the usage object.
For details on response headers specific to Foundry, see Correlation request IDs.
API model IDs and deployments
Lifecycle terms (Deprecated, Retired) are defined in Model deprecations. Microsoft Foundry follows the Claude API lifecycle schedule.
The following Claude models are available through Foundry:
| Model | Default deployment name | Hosted on Azure | Hosted on Anthropic |
|---|---|---|---|
| Claude Fable 5.2 | claude-fable-5-2 | ✓ | |
| Claude Mythos 5.2 (limited availability(opens in new tab)) | claude-mythos-5-2 | ✓ | |
| Claude Fable 5.1 | claude-fable-5-1 | ✓ | |
| Claude Mythos 5.1 (limited availability(opens in new tab)) | claude-mythos-5-1 | ✓ | |
| Claude Fable 5 | claude-fable-5 | ✓ | |
| Claude Mythos 5 (limited availability(opens in new tab)) | claude-mythos-5 | ✓ | |
| Claude Opus 5.5 | claude-opus-5-5 | ✓ | ✓ |
| Claude Opus 5 | claude-opus-5 | ✓ | ✓ |
| Claude Opus 4.8 | claude-opus-4-8 | ✓ | ✓ |
| Claude Opus 4.7 | claude-opus-4-7 | ✓ | |
| Claude Opus 4.6 | claude-opus-4-6 | ✓ | |
| Claude Opus 4.5 | claude-opus-4-5 | ✓ | |
| Claude Sonnet 5.5 | claude-sonnet-5-5 | ✓ | ✓ |
| Claude Sonnet 5 | claude-sonnet-5 | ✓ | ✓ |
| Claude Sonnet 4.6 | claude-sonnet-4-6 | ✓ | |
| Claude Sonnet 4.5 (deprecated) | claude-sonnet-4-5 | ✓ | |
| Claude Haiku 5.5 | claude-haiku-5-5 | ✓ | ✓ |
| Claude Haiku 4.5 | claude-haiku-4-5 | ✓ | ✓ |
By default, deployment names match the model IDs shown in the preceding table. However, you can create custom deployments with different names in the Foundry portal to manage different configurations, versions, or rate limits. Use the deployment name (not necessarily the model ID) in your API requests.
Claude Code
Let Claude Code migrate your code to a newer model
/claude-api migrate this project to the latest Claude Opus modelBilling
Claude in Microsoft Foundry bills through the Azure Marketplace. Usage is denominated in Claude Consumption Units (CCUs), metered hourly, and invoiced monthly in arrears on your Azure bill. CCUs are not prepaid credits. There is no CCU balance or commitment.
For the CCU price, conversion mechanics, and per-model token rates, see Claude in Microsoft Foundry pricing.
Migrating between hosting options
To move an existing deployment from one hosting option to the other:
- Create a new deployment of the model’s other hosting version (Hosted on Azure or Hosted on Anthropic). This can be in the same Foundry resource, or a new one.
- Update your application to pass the new deployment name in the
modelparameter. - Delete the old deployment once traffic has moved.
If the new deployment is in the same Foundry resource, your endpoint URL and authentication are unchanged. If you created a new resource, update your application’s endpoint and credentials to point to it.
Monitoring and logging
Azure provides monitoring and logging for your Claude usage through standard Azure patterns:
- Azure Monitor: Track API usage, latency, and error rates
- Azure Log Analytics: Query and analyze request/response logs
- Cost Management: Monitor and forecast costs associated with Claude usage
Anthropic recommends logging your activity on at least a 30-day rolling basis to understand usage patterns and investigate any potential issues.
Troubleshooting
Authentication errors
Error: 401 Unauthorized or Invalid API key
- Solution: Verify your API key is correct. You can find it in the Foundry portal on your deployment’s Details tab (under Build > Models).
- Solution: If using Microsoft Entra ID, ensure your access token is valid and hasn’t expired. Tokens typically expire after 1 hour.
Error: 403 Forbidden
Cause: Your Azure account might lack the necessary permissions.
- Solution: Ensure you have the appropriate Azure RBAC role assigned (for example, Foundry User or Cognitive Services User).
Rate limiting
Error: 429 Too Many Requests
- Solution: You’ve exceeded your rate limit. Implement exponential backoff and retry logic in your application.
- Solution: Consider requesting rate limit increases through the Azure portal or Azure support.
Rate limit headers
Foundry does not include Anthropic’s standard rate limit headers (anthropic-ratelimit-tokens-limit, anthropic-ratelimit-tokens-remaining, anthropic-ratelimit-tokens-reset, anthropic-ratelimit-input-tokens-limit, anthropic-ratelimit-input-tokens-remaining, anthropic-ratelimit-input-tokens-reset, anthropic-ratelimit-output-tokens-limit, anthropic-ratelimit-output-tokens-remaining, and anthropic-ratelimit-output-tokens-reset) in responses. Manage rate limiting through Azure’s monitoring tools instead.
Model and deployment errors
Error: Model not found or Deployment not found
- Solution: Verify you’re using the correct deployment name. If you haven’t created a custom deployment, use the default model ID (for example,
claude-opus-5-5). - Solution: Ensure the model/deployment is available in your Azure region.
Error: Invalid model parameter
- Solution: The
modelparameter should contain your deployment name, which can be customized in the Foundry portal. Verify the deployment exists and is properly configured.
Next steps
Explore Claude’s advanced features and capabilities.
Learn about Anthropic’s pricing structure for models and features.
As safer and more capable models launch, Anthropic regularly retires older ones. See all API deprecations, along with recommended replacements.
Additional resources
Browse Anthropic models in the Foundry catalog.
View Microsoft’s pricing details for Microsoft Foundry.
View Anthropic’s per-model pricing details.
Manage your Azure resources.
Was this page helpful?