Claude Code Azure MCP Server Guide
The Azure MCP server connects Claude Code to your Azure cloud resources through the Model Context Protocol. This guide walks through setup, authentication, and practical usage so Claude Code can manage App Services, Azure Functions, Storage, and other Azure resources directly from your terminal.
The Problem
Azure developers managing cloud infrastructure alongside code changes face constant context switching. The Azure Portal is browser-based, the Azure CLI outputs raw text, and Claude Code has no native Azure awareness. You lose time describing your infrastructure state, copying resource details, and translating between tools.
Quick Solution
- Ensure Azure CLI is installed and authenticated:
az login
az account show
- Add the Azure MCP server to
.claude/settings.json:
{
"mcpServers": {
"azure": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-azure"],
"env": {
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZURE_RESOURCE_GROUP": "your-resource-group"
}
}
}
}
- Restart Claude Code and verify:
claude /mcp
# Should list "azure" with available tools
- Test the connection with a resource query:
List all App Services in my resource group
How It Works
The Azure MCP server wraps the Azure SDK for JavaScript, exposing Azure Resource Manager operations as structured tools. When Claude Code starts, it spawns the MCP server process, which authenticates using your local Azure CLI session or environment credentials.
The server exposes tools organized by service: compute (VMs, App Services, Functions), storage (Blob, Table, Queue), networking (VNets, NSGs, Load Balancers), and monitoring (Metrics, Logs, Alerts). Each tool accepts typed parameters and returns structured JSON.
Authentication follows the Azure DefaultAzureCredential chain: environment variables, managed identity, Azure CLI, and then interactive browser. For local development, the Azure CLI credential is the most common path. The MCP server inherits whatever permissions your Azure identity has, so role-based access control (RBAC) governs what Claude Code can do.
Common Issues
DefaultAzureCredential failure: If the MCP server cannot authenticate, ensure az login is current. Check with az account get-access-token to verify your session is valid.
Wrong subscription context: Azure accounts often have multiple subscriptions. Set the correct one with az account set --subscription "name-or-id" and match it in your MCP env config.
Resource group not found: Double-check the resource group name and ensure it exists in the configured subscription. Names are case-insensitive but must match exactly.
Example CLAUDE.md Section
# Azure Cloud Context
## MCP Server
- Azure MCP configured in .claude/settings.json
- Subscription: Production (sub-123)
- Resource Group: rg-webapp-prod
- Region: East US 2
## Infrastructure
- App Service Plan: asp-webapp-prod (P1v3)
- Web App: webapp-api-prod
- Azure Functions: func-workers-prod
- Storage: stwebappprod (Blob + Queue)
- Azure SQL: sql-webapp-prod/db-main
- Application Insights: ai-webapp-prod
## Rules
- NEVER scale down the App Service Plan without approval
- Use deployment slots (staging) before swapping to production
- Storage account is geo-redundant; do not change replication settings
- Always check Application Insights after deployments
Best Practices
- Scope to a single resource group. Set
AZURE_RESOURCE_GROUPin the MCP config so Claude Code defaults to your project’s resource group without needing to specify it each time. - Use RBAC Reader role for safety. Assign the
Readerrole to your service principal for day-to-day querying. Escalate toContributoronly for deployment sessions. - Document infrastructure relationships. Azure resources have dependencies (App Service depends on App Service Plan, which depends on Resource Group). Map these in CLAUDE.md.
- Tag resources consistently. Azure tags help Claude Code filter and identify resources. Use tags like
project:myappandenvironment:prod. - Review cost impact. Before letting Claude Code create or scale resources, document cost constraints in CLAUDE.md to prevent unexpected charges.
Related Reading
- Claude Code MCP Server Setup
- Claude Code ECONNREFUSED MCP Fix
- Claude Code MCP Server Disconnected Fix
Built by theluckystrike. More at zovo.one