azure-billing-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@azure-billing-mcp-servershow my costs by service for last month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Azure Billing MCP Server
MCP server for Azure spend, cost analysis, and billing via the Azure Cost Management and Billing APIs. Deployed to Google Cloud Run and connected to Gemini Enterprise.
Architecture
User in Gemini Enterprise
│
▼
Gemini Enterprise ──► Entra ID OAuth (login.microsoftonline.com)
│ receives access token (scope: api://<client-id>/mcp.access)
▼
MCP Server on Cloud Run (access gated by Cloud Run IAM)
BearerTokenMiddleware captures the token for audit logging only —
it is NOT forwarded to Azure (wrong audience for management.azure.com)
│
▼
Server's own service principal ──► Azure Cost Management + Billing APIs
│
▼
Response back to Gemini Enterprise ──► UserThe Entra ID app used for GE login and the service principal used for billing are two separate identities. The incoming token is logged for visibility but never used to call Azure.
Related MCP server: Azure FinOps Elite
Files
server.py # FastMCP app, Azure client, all 11 tools, entrypoint
requirements.txt
Dockerfile
deploy_cloudrun.sh # build image, deploy to Cloud Run, grant IAM
.env.example # for local development
SETUP.md # complete step-by-step setup guide for clientsTools (11 total)
Cost Management
Tool | Description |
| List all accessible Azure subscriptions |
| General-purpose cost query (timeframe, granularity, grouping) |
| Cost breakdown by Azure service |
| Cost breakdown by resource group |
| Day-by-day cost time series |
| Top N most expensive resources |
Billing API
Tool | Description |
| List billing accounts |
| List billing periods history |
| List invoices for a billing account |
| Detailed usage records by date range |
| Budget limits and current spend vs limit |
All tools are read-only (readOnlyHint=True).
Two Separate Credentials
Credential | Purpose | Used by |
Azure service principal ( | Queries Azure billing APIs | The MCP server itself |
Entra ID app registration ( | OAuth login screen for GE | Gemini Enterprise |
Do NOT mix these up — they serve different roles.
Gemini Enterprise Setup
MCP Server URL
https://<your-cloud-run-url>/mcpPrinted by deploy_cloudrun.sh after deploy.
Authentication Settings (fill in GE form)
Field | Value |
MCP Server URL |
|
Authorization URL |
|
Token URL |
|
Client ID | Application (client) ID of |
Client Secret | Secret from |
Scopes |
|
Enable PKCE | Leave unchecked |
MCP Agent Instructions (paste into GE)
You have access to Azure Cost Management and Billing tools for querying actual
Azure spend, invoices, budgets, and usage. All tools are read-only.
If the user doesn't specify a subscription, call list_subscriptions first.
For invoice queries, call get_billing_accounts first.
Default timeframe is "MonthToDate" unless the user asks for a different period.Required Redirect URIs (add in Entra ID App Registration → Authentication)
https://vertexaisearch.cloud.google.com/console/oauth/default_oauth.html
https://vertexaisearch.cloud.google.com/oauth-redirectLocal Development
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # fill in AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET
python server.py # runs at http://0.0.0.0:8080/mcpDeploy to Cloud Run
# 1. Fill in deploy_cloudrun.sh variables:
# GCP_PROJECT, COST_MGMT_TENANT_ID, COST_MGMT_CLIENT_ID
# 2. Store the Azure client secret in Secret Manager:
printf '%s' 'YOUR_SECRET' | gcloud secrets create Azure_secret_value \
--project <your-gcp-project-id> --data-file=-
# 3. Deploy:
bash deploy_cloudrun.shFor the full step-by-step client setup guide including Azure Portal screenshots, see SETUP.md.
Subscription Type Requirement
The Cost Management and Billing APIs require a paid commercial Azure subscription:
✅ Works | ❌ Does NOT work |
Pay-As-You-Go | Free Trial |
Enterprise Agreement (EA) | Visual Studio / Dev/Test |
Microsoft Customer Agreement (MCA) | CSP / Sponsored |
Troubleshooting
Error | Cause | Fix |
| Wrong Client Secret in GE form | Use the |
| Cloud Run server not starting | Re-grant Secret Manager permission to the compute service account |
| Free Trial subscription | Upgrade to Pay-As-You-Go |
| Placeholder credentials in deploy script | Fill in real |
| Cloud Run SA lacks Secret Manager access | Run |
| GE service account missing invoker role | Re-run the IAM grant in |
| Missing Billing Reader role | Assign |
Tools return empty | Service principal has no subscription access | Assign |
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceCloud cost management MCP server for Azure. Ask your AI about your cloud bill.Last updated151161MIT
- Alicense-qualityDmaintenanceProduction-grade MCP server for enterprise Azure cost optimization, enabling spend anomaly detection, multi-tenant auditing, budget validation, and compliance-aware recommendations.Last updated1MIT
- Alicense-qualityDmaintenanceAnalyzes Azure cloud costs, audits for waste, and provides budget insights via natural language through a secure local MCP server.Last updated2MIT
- Flicense-qualityDmaintenanceAn MCP server that gives Claude live access to Azure pricing and cost data — retail prices, VM comparisons, reservation analysis, architecture estimates, and actual subscription spend.Last updated
Related MCP Connectors
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
Hosted MCP server exposing US hospital procedure cost data to AI assistants
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/vamsitejeswar/Azure-Billing-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server