Azure Resource Manager MCP server

Integrates with Azure cloud services to enable resource listing, management, and cost analysis through service principal authentication and the Azure Cost Management API
Back to servers
Setup instructions
Provider
tim10002
Release date
Mar 25, 2025
Language
Python
Stats
2 stars

The Azure Resource MCP Server enables you to list and query Azure resources directly from any MCP client. This tool helps you efficiently browse your Azure infrastructure and analyze costs without leaving your workflow, making it ideal for cloud resource management.

Features

  • 📊 Resource Discovery - List all resources across your Azure subscriptions
  • 🔍 Filtering - Filter resources by resource group name
  • 💰 Cost Analysis - Retrieve cost information for your Azure subscriptions
  • 🔐 Secure - Uses your Azure service principal credentials
  • 🏷️ Detailed View - See locations, types, and tags for all your resources

Installation

Prerequisites

  • Python 3.10+
  • Azure subscription with appropriate permissions
  • Service principal with reader access to resources

Setup

If you prefer using uv:

# Setup environment with uv
uv venv
.venv\Scripts\activate  # On Windows
source .venv/bin/activate  # On macOS/Linux

# Install dependencies
uv add mcp[cli] azure-identity python-dotenv azure-mgmt-resource aiohttp

# Run server
uv run -m azure_resource_mcp_server

Configuration

Setting up Azure

  1. Create an Azure service principal for authentication:
az ad sp create-for-rbac --name {service principal name}
  1. Assign appropriate reader permissions to the service principal
  2. Note your Azure subscription ID, tenant ID, client ID, and client secret
  3. Set up the required environment variables

Environment Variables

This server requires the following environment variables:

# Required Azure authentication
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
AZURE_SUBSCRIPTION_ID=your-subscription-id

Usage

Available Tools

list_azure_resources

Lists Azure resource groups and resources using service principal authentication.

Inputs:

  • subscription_id (string, optional): Specific subscription ID to query. If not provided, uses the default subscription from environment variables.
  • resource_group_filter (string, optional): Filter resource groups by name (case-insensitive contains match).

Returns: Formatted markdown list of resource groups and their resources with details such as location, type, and tags.

get_azure_costs_rest

Gets cost analysis data for an Azure subscription using the REST API.

Inputs:

  • subscription_id (string, optional): Specific subscription ID to query. If not provided, uses the default subscription from environment variables.
  • timeframe (string, optional): Time period for cost analysis. Default is "MonthToDate".

Returns: Formatted markdown with cost analysis data, including daily costs and totals.

Integration with Claude Desktop

To use with Claude Desktop, add the following to your configuration file:

{
  "mcpServers": {
    "azure-resource": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/PARENT/FOLDER",
        "run",
        "-m",
        "azure_resource_mcp_server"
      ],
      "env": {
        "AZURE_TENANT_ID": "your-tenant-id",
        "AZURE_CLIENT_ID": "your-client-id",
        "AZURE_CLIENT_SECRET": "your-client-secret",
        "AZURE_SUBSCRIPTION_ID": "your-subscription-id"
      }
    }
  }
}

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "azure-resource" '{"command":"uv","args":["--directory","/ABSOLUTE/PATH/TO/PARENT/FOLDER","run","-m","azure_resource_mcp_server"],"env":{"AZURE_TENANT_ID":"your-tenant-id","AZURE_CLIENT_ID":"your-client-id","AZURE_CLIENT_SECRET":"your-client-secret","AZURE_SUBSCRIPTION_ID":"your-subscription-id"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "azure-resource": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER",
                "run",
                "-m",
                "azure_resource_mcp_server"
            ],
            "env": {
                "AZURE_TENANT_ID": "your-tenant-id",
                "AZURE_CLIENT_ID": "your-client-id",
                "AZURE_CLIENT_SECRET": "your-client-secret",
                "AZURE_SUBSCRIPTION_ID": "your-subscription-id"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "azure-resource": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER",
                "run",
                "-m",
                "azure_resource_mcp_server"
            ],
            "env": {
                "AZURE_TENANT_ID": "your-tenant-id",
                "AZURE_CLIENT_ID": "your-client-id",
                "AZURE_CLIENT_SECRET": "your-client-secret",
                "AZURE_SUBSCRIPTION_ID": "your-subscription-id"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later