claude-in-microsoft-foundry changedbuild-with-claude/claude-in-microsoft-foundry
Nearest release: v2.1.286, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+41added
Lines−39removed
From line
39
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits16to this page, all time
The whole hunk
from line 39, old and new numbered
/
from line 39
3939Anthropic's [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) 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](https://platform.claude.com/docs/en/cli-sdks-libraries/cli/quickstart).
4040
4141<Note>
42 Foundry is supported by the C#, Java, PHP, Python, and TypeScript SDKs. Foundry is not currently available in the Go and Ruby SDKs.
42 Foundry is supported by the C#, Go, Java, PHP, Python, and TypeScript SDKs. Foundry is not currently available in the Ruby SDK.
4343</Note>
4444
4545<Tabs>
from line 69
6969
7070 <Tab title="Go">
7171 ```bash
72 # The Go SDK does not yet support Foundry natively (see the Authentication
73 # examples for using the standard Go SDK as a workaround)
74 go get github.com/anthropics/anthropic-sdk-go
72 go get github.com/anthropics/anthropic-sdk-go/foundry
73
74 # For Entra ID authentication, also install the Azure Identity library
75 go get github.com/Azure/azure-sdk-for-go/sdk/azidentity
7576 ```
7677 </Tab>
7778
from line 184
1831843. Copy the **Key** value (and note the **Target URI** for your endpoint).
1841854. Use either the `api-key` or `x-api-key` header in your requests, or provide it to the SDK.
185186
186The Foundry SDKs require an API key and either a resource name or base URL. The C#, Java, PHP, Python, and TypeScript SDKs automatically read these from the following environment variables if they are defined:
187The 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:
187188
188189* `ANTHROPIC_FOUNDRY_API_KEY` - Your API key
189190* `ANTHROPIC_FOUNDRY_RESOURCE` - Your resource name (for example, `example-resource`)
from line 260
259260 using Anthropic.Foundry;
260261 using Anthropic.Models.Messages;
261262
263 // The C# client always builds the base URL from the resource name.
264 // It does not read ANTHROPIC_FOUNDRY_BASE_URL.
262265 var client = new AnthropicFoundryClient(
263266 new AnthropicFoundryApiKeyCredentials(
264267 Environment.GetEnvironmentVariable("ANTHROPIC_FOUNDRY_API_KEY")!,
from line 284
281284 ```
282285
283286 ```go Go
284 // The Go SDK does not yet support Foundry natively. This example uses the
285 // standard Go SDK as a workaround. WithoutEnvironmentDefaults keeps the
286 // client from also reading ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN from
287 // the environment and sending a Claude API credential to your Foundry
288 // endpoint. Features that Foundry does not support fail server-side rather
289 // than client-side. For full Foundry support, use the C#, Java, PHP,
290 // Python, or TypeScript SDKs.
291287 package main
292288
293289 import (
from line 292
296292 "os"
297293
298294 "github.com/anthropics/anthropic-sdk-go"
299 "github.com/anthropics/anthropic-sdk-go/option"
295 "github.com/anthropics/anthropic-sdk-go/foundry"
300296 )
301297
302298 func main() {
303 client := anthropic.NewClient(
304 option.WithoutEnvironmentDefaults(),
305 option.WithBaseURL("https://example-resource.services.ai.azure.com/anthropic"),
306 option.WithAPIKey(os.Getenv("ANTHROPIC_FOUNDRY_API_KEY")),
307 )
299 client, err := foundry.NewClient(foundry.ClientConfig{
300 APIKey: os.Getenv("ANTHROPIC_FOUNDRY_API_KEY"),
301 Resource: "example-resource", // your resource name
302 })
303 if err != nil {
304 panic(err)
305 }
308306
309307 message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
310308 Model: "claude-opus-5-5",
from line 367
369367 # ANTHROPIC_AUTH_TOKEN environment variables and could send a Claude API
370368 # credential to your Foundry endpoint. Features that Foundry
371369 # does not support fail server-side rather than client-side. For full
372 # Foundry support, use the C#, Java, PHP, Python, or TypeScript SDKs.
370 # Foundry support, use the C#, Go, Java, PHP, Python, or TypeScript SDKs.
373371 require "anthropic"
374372
375373 client = Anthropic::Client.new(
from line 500
502500 ```
503501
504502 ```go Go
505 // The Go SDK does not yet support Foundry natively. This example uses the
506 // standard Go SDK as a workaround, with a static Entra ID token: automatic
507 // token refresh is not built in, so your application must refresh tokens
508 // itself (they typically expire after 1 hour). WithoutEnvironmentDefaults
509 // keeps the client from also reading ANTHROPIC_API_KEY or
510 // ANTHROPIC_AUTH_TOKEN from the environment and sending a Claude API
511 // credential to your Foundry endpoint. For full Foundry support, use the
512 // C#, Java, PHP, Python, or TypeScript SDKs.
513503 package main
514504
515505 import (
516506 "context"
517507 "fmt"
518 "os"
519508
509 "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
510 "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
520511 "github.com/anthropics/anthropic-sdk-go"
521 "github.com/anthropics/anthropic-sdk-go/option"
512 "github.com/anthropics/anthropic-sdk-go/foundry"
522513 )
523514
524515 func main() {
525 // Obtain an Entra ID access token, for example using the Azure CLI:
526 // az account get-access-token --resource https://ai.azure.com \
527 // --query accessToken -o tsv
528 client := anthropic.NewClient(
529 option.WithoutEnvironmentDefaults(),
530 option.WithBaseURL("https://example-resource.services.ai.azure.com/anthropic"),
531 option.WithAuthToken(os.Getenv("AZURE_ACCESS_TOKEN")),
532 )
516 credential, err := azidentity.NewDefaultAzureCredential(nil)
517 if err != nil {
518 panic(err)
519 }
533520
521 tokenProvider := func(ctx context.Context) (string, error) {
522 token, err := credential.GetToken(ctx, policy.TokenRequestOptions{
523 Scopes: []string{foundry.EntraIDScope},
524 })
525 return token.Token, err
526 }
527
528 client, err := foundry.NewClient(foundry.ClientConfig{
529 Resource: "example-resource", // your resource name
530 AzureADTokenProvider: tokenProvider,
531 })
532 if err != nil {
533 panic(err)
534 }
535
534536 message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
535537 Model: "claude-opus-5-5",
536538 MaxTokens: 1024,
from line 611
609611 # itself (they typically expire after 1 hour). Pass credentials explicitly:
610612 # without them, the client falls back to the ANTHROPIC_API_KEY or
611613 # ANTHROPIC_AUTH_TOKEN environment variables. For full Foundry support, use
612 # the C#, Java, PHP, Python, or TypeScript SDKs.
614 # the C#, Go, Java, PHP, Python, or TypeScript SDKs.
613615 require "anthropic"
614616
615617 # Obtain an Entra ID access token, for example using the Azure CLI:
No line in this hunk matches that.