azure-ai-foundry.md +0 −216 deleted
File Deleted View Diff
1> ## Documentation Index
2> Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt
3> Use this file to discover all available pages before exploring further.
4
5# Claude Code on Microsoft Foundry
6
7> Learn about configuring Claude Code through Microsoft Foundry, including setup, configuration, and troubleshooting.
8
9export const ContactSalesCard = ({surface}) => {
10 const utm = content => `utm_source=claude_code&utm_medium=docs&utm_content=${surface}_${content}`;
11 const iconArrowRight = (size = 13) => <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
12 <line x1="5" y1="12" x2="19" y2="12" />
13 <polyline points="12 5 19 12 12 19" />
14 </svg>;
15 const STYLES = `
16.cc-cs {
17 --cs-slate: #141413;
18 --cs-clay: #d97757;
19 --cs-clay-deep: #c6613f;
20 --cs-gray-000: #ffffff;
21 --cs-gray-700: #3d3d3a;
22 --cs-border-default: rgba(31, 30, 29, 0.15);
23 font-family: inherit;
24}
25.dark .cc-cs {
26 --cs-slate: #f0eee6;
27 --cs-gray-000: #262624;
28 --cs-gray-700: #bfbdb4;
29 --cs-border-default: rgba(240, 238, 230, 0.14);
30}
31.cc-cs-card {
32 display: flex; align-items: center; justify-content: space-between;
33 gap: 16px; padding: 14px 16px; margin: 0;
34 background: var(--cs-gray-000); border: 0.5px solid var(--cs-border-default);
35 border-radius: 8px; flex-wrap: wrap;
36}
37.cc-cs-text { font-size: 13px; color: var(--cs-gray-700); line-height: 1.5; flex: 1; min-width: 240px; }
38.cc-cs-text strong { font-weight: 550; color: var(--cs-slate); }
39.cc-cs-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
40.cc-cs-btn-clay {
41 display: inline-flex; align-items: center; gap: 8px;
42 background: var(--cs-clay-deep); color: #fff; border: none;
43 border-radius: 8px; padding: 8px 14px;
44 font-size: 13px; font-weight: 500;
45 transition: background-color 0.15s; white-space: nowrap;
46}
47.cc-cs-btn-clay:hover { background: var(--cs-clay); }
48.cc-cs-btn-ghost {
49 display: inline-flex; align-items: center; gap: 8px;
50 background: transparent; color: var(--cs-gray-700);
51 border: 0.5px solid var(--cs-border-default);
52 border-radius: 8px; padding: 8px 14px;
53 font-size: 13px; font-weight: 500;
54}
55.cc-cs-btn-ghost:hover { background: rgba(0, 0, 0, 0.04); }
56.dark .cc-cs-btn-ghost:hover { background: rgba(255, 255, 255, 0.04); }
57@media (max-width: 720px) {
58 .cc-cs-actions { width: 100%; }
59}
60`;
61 return <div className="cc-cs not-prose">
62 <style>{STYLES}</style>
63 <div className="cc-cs-card">
64 <div className="cc-cs-text">
65 <strong>Deploying Claude Code across your organization?</strong> Talk to sales about enterprise plans, SSO, and centralized billing.
66 </div>
67 <div className="cc-cs-actions">
68 <a href={`https://claude.com/pricing?${utm('view_plans')}#plans-business`} className="cc-cs-btn-ghost">
69 View plans
70 </a>
71 <a href={`https://claude.com/contact-sales?${utm('contact_sales')}`} className="cc-cs-btn-clay">
72 Contact sales {iconArrowRight()}
73 </a>
74 </div>
75 </div>
76 </div>;
77};
78
79<ContactSalesCard surface="foundry" />
80
81## Prerequisites
82
83Before configuring Claude Code with Microsoft Foundry, ensure you have:
84
85* An Azure subscription with access to Microsoft Foundry
86* RBAC permissions to create Microsoft Foundry resources and deployments
87* Azure CLI installed and configured (optional - only needed if you don't have another mechanism for getting credentials)
88
89<Note>
90 If you are deploying Claude Code to multiple users, [pin your model versions](#4-pin-model-versions) before rolling out.
91</Note>
92
93## Setup
94
95### 1. Provision Microsoft Foundry resource
96
97First, create a Claude resource in Azure:
98
991. Navigate to the [Microsoft Foundry portal](https://ai.azure.com/)
1002. Create a new resource, noting your resource name
1013. Create deployments for the Claude models:
102 * Claude Opus
103 * Claude Sonnet
104 * Claude Haiku
105
106### 2. Configure Azure credentials
107
108Claude Code supports two authentication methods for Microsoft Foundry. Choose the method that best fits your security requirements.
109
110**Option A: API key authentication**
111
1121. Navigate to your resource in the Microsoft Foundry portal
1132. Go to the **Endpoints and keys** section
1143. Copy **API Key**
1154. Set the environment variable:
116
117```bash theme={null}
118export ANTHROPIC_FOUNDRY_API_KEY=your-azure-api-key
119```
120
121**Option B: Microsoft Entra ID authentication**
122
123When `ANTHROPIC_FOUNDRY_API_KEY` is not set, Claude Code automatically uses the Azure SDK [default credential chain](https://learn.microsoft.com/en-us/azure/developer/javascript/sdk/authentication/credential-chains#defaultazurecredential-overview).
124This supports a variety of methods for authenticating local and remote workloads.
125
126On local environments, you commonly may use the Azure CLI:
127
128```bash theme={null}
129az login
130```
131
132<Note>
133 When using Microsoft Foundry, the `/logout` command is unavailable since authentication is handled through Azure credentials.
134</Note>
135
136### 3. Configure Claude Code
137
138Set the following environment variables to enable Microsoft Foundry:
139
140```bash theme={null}
141# Enable Microsoft Foundry integration
142export CLAUDE_CODE_USE_FOUNDRY=1
143
144# Azure resource name (replace {resource} with your resource name)
145export ANTHROPIC_FOUNDRY_RESOURCE={resource}
146# Or provide the full base URL:
147# export ANTHROPIC_FOUNDRY_BASE_URL=https://{resource}.services.ai.azure.com/anthropic
148```
149
150### 4. Pin model versions
151
152<Warning>
153 Pin specific model versions for every deployment. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code's built-in default for Foundry, which can lag the newest release and may not yet be available in your account. Foundry has no startup model check, so requests fail when the default is unavailable. When you create Azure deployments, select a specific model version rather than "auto-update to latest."
154</Warning>
155
156Set the model variables to match the deployment names you created in step 1.
157
158Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Foundry resolves to Opus 4.6. Set it to the Opus 4.8 ID to use the latest model:
159
160```bash theme={null}
161export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8'
162export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6'
163export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5'
164```
165
166Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Foundry, Claude Code defaults this to the primary model because not every account has a Haiku deployment. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a Haiku deployment that is available in your account, as shown above.
167
168For current and legacy model IDs, see [Models overview](https://platform.claude.com/docs/en/about-claude/models/overview). See [Model configuration](/en/model-config#pin-models-for-third-party-deployments) for the full list of environment variables.
169
170[Prompt caching](/en/prompt-caching) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set the following variable; cache writes with a 1-hour TTL are billed at a higher rate:
171
172```bash theme={null}
173export ENABLE_PROMPT_CACHING_1H=1
174```
175
176### 5. Run Claude Code
177
178With the environment variables set, start Claude Code from your project directory:
179
180```bash theme={null}
181claude
182```
183
184Claude Code reads `CLAUDE_CODE_USE_FOUNDRY` and the other Foundry variables from the environment and connects to your Azure resource on the first prompt. Unlike Bedrock and Vertex AI, Foundry has no interactive setup wizard, so the environment variables in steps 3 and 4 are the only configuration path.
185
186## Azure RBAC configuration
187
188The `Azure AI User` and `Cognitive Services User` default roles include all required permissions for invoking Claude models.
189
190For more restrictive permissions, create a custom role with the following:
191
192```json theme={null}
193{
194 "permissions": [
195 {
196 "dataActions": [
197 "Microsoft.CognitiveServices/accounts/providers/*"
198 ]
199 }
200 ]
201}
202```
203
204For details, see [Microsoft Foundry RBAC documentation](https://learn.microsoft.com/en-us/azure/ai-foundry/concepts/rbac-azure-ai-foundry).
205
206## Troubleshooting
207
208If you receive an error "Failed to get token from azureADTokenProvider: ChainedTokenCredential authentication failed":
209
210* Configure Entra ID on the environment, or set `ANTHROPIC_FOUNDRY_API_KEY`.
211
212## Additional resources
213
214* [Microsoft Foundry documentation](https://learn.microsoft.com/en-us/azure/ai-foundry/what-is-azure-ai-foundry)
215* [Microsoft Foundry models](https://ai.azure.com/explore/models)
216* [Microsoft Foundry pricing](https://azure.microsoft.com/en-us/pricing/details/ai-foundry/)