Getting Started

Your First Claude Call on Microsoft Foundry

For Azure organizations, Claude arrives through Microsoft Foundry: create a resource, grab a key, and you are three lines of Python from a response.

Claude 3P 101 · Updated July 2026 · Unofficial guide

Microsoft Foundry is Azure's platform for foundation models, and it is how Azure-centric enterprises consume Claude. The pattern will feel familiar to anyone who has used other Azure AI services: you create a resource in your subscription, the resource gives you an endpoint and API keys, and everything is billed and governed through Azure. This guide takes you from subscription to first response.

Prerequisites: a subscription and a Foundry resource

An Azure subscription with permission to create resources. In most enterprises this means working within a resource group your platform team has assigned. Claude usage will be metered to this subscription like any other Azure service.

A Foundry resource with Claude available. In the Azure portal, create the Foundry resource in your chosen resource group and region, and make the Anthropic models available to it. When the resource is provisioned, note two things from its overview page: the resource name and an API key. Those are exactly the two values the Python client needs.

Unlike Bedrock (IAM roles) and Vertex AI (Application Default Credentials), Foundry authenticates the first call with a resource API key. Treat that key like a password from minute one: put it in an environment variable or your secret manager, never in source code.

Install the SDK and make the call

Foundry uses Anthropic's official Python SDK — the same package as every other platform, so code you write here ports almost unchanged elsewhere:

pip install -U anthropic

import os
from anthropic import AnthropicFoundry

client = AnthropicFoundry(
    api_key=os.environ["FOUNDRY_API_KEY"],
    resource="your-resource-name",
)

message = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=512,
    messages=[
        {"role": "user", "content": "In one sentence, what is Microsoft Foundry?"}
    ],
)
print(message.content[0].text)

Export the key first (export FOUNDRY_API_KEY=...), run the script, and Claude Sonnet 5 answers through your Azure resource. The model ID is the bare first-party form — claude-sonnet-5, claude-opus-4-8, claude-haiku-4-5 — with no platform prefix; only Bedrock prefixes IDs.

The beta caveat, stated plainly

Foundry's distinguishing trait among the third-party platforms is breadth with a footnote: it supports more of the newer Claude capabilities than Bedrock or Vertex AI, but a few of those features are still in beta as of July 2026. The core set — Messages API, streaming, tool use, vision, extended and adaptive thinking, prompt caching — is solid across all four platforms and fine to build on. Beyond that core, features like the Batch API, Files API, and the code execution and web tools are mostly beta on Foundry.

Rule of thumb: build your pilot on Foundry's core features freely, but before a production commitment, list every beta-flagged feature on your critical path and get your Microsoft contact to speak to its status and support terms. Beta means the behavior or availability can change under you.

First-week habits that pay off

Log token usage immediately. Every response reports input and output token counts — the exact units on your Azure bill. Capture them from the first script so cost conversations later are grounded in data.

Plan the key-management story now. A key in an environment variable is fine for day one; production should draw it from your secret manager with rotation, like any other Azure credential. Decide who owns that before the pilot becomes load-bearing.

Try all three tiers. Swapping the model ID is the whole change. Run the same prompt through Haiku 4.5, Sonnet 5, and Opus 4.8 and compare quality against price — it is the cheapest architecture experiment you will ever run.

Involve the Azure governance owners early. Because Claude arrives as an ordinary Azure resource, it can be folded into the tagging, budgeting, and access-review routines your organization already runs. Pilots that register with those routines in week one avoid the awkward month-three conversation where a finance or security team discovers an untracked AI workload — and the deployment largely inherits your Azure compliance posture, though the specifics are worth confirming with Microsoft for your industry.

Where to go next

For resource configuration in more depth, read creating and configuring a Foundry resource; for choosing a model tier, see Opus, Sonnet, Haiku explained. The feature matrix tracks what is beta where.