If your company has already deployed Claude models on Microsoft Foundry, you can basically use Claude Code for free and save $17/month on a Claude subscription.
Check Your Access to Foundry
Microsoft Foundry (formerly Azure AI Studio) is a unified, enterprise-grade AI platform-as-a-service designed for developers to build, customize, and deploy AI applications and agents.
- Go to https://ai.azure.com/nextgen
- Click Build on the top navigation bar
- Click Models in the side menu
Make sure your organization already has Claude models deployed in Foundry (for example claude-opus-4-7).
Connect Foundry Models to Claude Code
I recommend using Entra ID + Azure CLI authentication. It's safer and more convenient than managing API keys manually.
Install Azure CLI before continuing:
After installing Azure CLI, sign in with:
az login
Set the following environment variables to enable Microsoft Foundry integration in Claude Code.
I usually put them in my .zshrc.
# Enable Microsoft Foundry integration
export CLAUDE_CODE_USE_FOUNDRY=1
# Azure resource name (replace {resource} with your resource name)
export ANTHROPIC_FOUNDRY_RESOURCE={resource}
# Or provide the full base URL:
# export ANTHROPIC_FOUNDRY_BASE_URL=https://{resource}.services.ai.azure.com/anthropic
In the current Foundry UI, resource are renamed to project.
Set the model variables to match your deployment names.
By default, the opus alias on Foundry may still resolve to Opus 4.6. To make sure Claude Code uses Opus 4.7, explicitly set:
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-7'
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5'
Common Issues
Wrong Azure tenant
If your company uses multiple Azure tenants, az login may authenticate against the wrong one.
Check your current tenant with:
az account show
Switch tenants if needed:
az login --tenant <tenant-id>
Deployment name mismatch
The model name in Claude Code must match the deployment name configured in Foundry.
For example:
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-7'
must exactly match the deployment name shown in the Foundry Models page.
Side Notes
Some companies provide Azure subscriptions or enterprise credits for internal development.
So even if your IT team has not deployed Claude models yet, you may still be able to deploy them yourself.
Just make sure you have permission before creating resources.
Top comments (0)