az

azure-cli-mcp

A wrapper around the Azure CLI command line that allows you to talk directly to Azure

Publisherazure-cli-mcp
Submitted date4/13/2025

Unleash the Power of Azure with AI: An MCP Server for Azure CLI

Harness the full potential of the Azure CLI within your LLM applications using this Model Context Protocol (MCP) server. Seamlessly integrate Azure management into your AI workflows, enabling intelligent automation and insightful analysis.

smithery badge

See it in Action

Quick Demo with Claude Desktop (2 minutes)

Short Demo

Comprehensive Demo with VS Code (18 minutes)

Complete Demo

Capabilities: Azure CLI at Your Command

This MCP server unlocks the complete functionality of the Azure CLI, empowering you to:

  • Inspect and Analyze: Retrieve detailed information about your Azure resources, including configuration settings, performance metrics, and security policies. For example, effortlessly check the rate limits of your Azure OpenAI deployments.
  • Automate Remediation: Proactively address configuration issues and security vulnerabilities. Instruct the server to harden a Blob Storage account or enforce compliance policies.
  • Orchestrate Resource Provisioning: Streamline the creation of new Azure resources. Automate the deployment of Azure Container Apps, Azure Container Registries, and their interconnections using managed identities.

Responsible Usage: A Word of Caution

While this MCP server offers immense power, it's crucial to exercise caution. Always validate the commands generated by the LLM before execution. Leverage advanced LLMs like Claude 3.7 or GPT-4o, known for their robust Azure training data, to minimize potential errors.

Security Considerations: Run Locally, Not Remotely

Important: This MCP server is designed for local execution only. Do not deploy it on a remote server.

The server executes az commands on your behalf and could be exploited by malicious actors if exposed to external networks. The current implementation utilizes the stio transport, intended for local operation with your existing Azure CLI credentials.

Future iterations may incorporate http transport and Azure token authentication for secure remote access, pending further stabilization of the MCP specification and SDK.

Installation Guide: Docker or Java

Choose the installation method that best suits your environment: Docker container or Java executable JAR file. Both options currently support the stio transport.

Docker Installation

  1. Create an Azure Service Principal:

    az ad sp create-for-rbac --name "azure-cli-mcp" --role contributor --scopes /subscriptions/<your-subscription-id>/resourceGroups/<your-resource-group> --json-auth

    Replace <your-subscription-id> and <your-resource-group> with your actual Azure subscription and resource group details.

  2. Run the Docker Container:

    docker run --rm -p 6273:6273 -e AZURE_CREDENTIALS="{"clientId":"....","clientSecret":"....",...}" -i ghcr.io/jdubois/azure-cli-mcp:latest

    Set the AZURE_CREDENTIALS environment variable with the JSON output from the Service Principal creation.

Integration with VS Code

  1. Install GitHub Copilot.
  2. Install the MCP Server using the VS Code command palette (MCP: Add Server...).
    • Configure the server to connect using the stio transport.
    • Set the command to run as docker run -i --rm -e AZURE_CREDENTIALS ghcr.io/jdubois/azure-cli-mcp:latest.
    • Securely configure the AZURE_CREDENTIALS environment variable using VS Code's input mechanism (see example below).
  3. Enable Agent mode in GitHub Copilot.
  4. Verify that the azure-cli-mcp server is listed as a tool in the chat window.

Securely Configuring AZURE_CREDENTIALS in VS Code:

{ "inputs": [ { "type": "promptString", "id": "azure-credentials", "description": "Azure Credentials", "password": true } ], "servers": { "azure-cli": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "AZURE_CREDENTIALS", "ghcr.io/jdubois/azure-cli-mcp:latest" ], "env": { "AZURE_CREDENTIALS": "${input:azure-credentials}" } } } }

Integration with Claude Desktop

Add the server configuration to your claude_desktop_config.json file:

{ "mcpServers": { "azure-cli": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "AZURE_CREDENTIALS", "ghcr.io/jdubois/azure-cli-mcp:latest" ], "env": { "AZURE_CREDENTIALS": "{\"clientId\":\"...\",\"clientSecret\":\"...\",..." } } } }

Java Installation

  1. Install the Azure CLI: Follow the instructions here.

  2. Authenticate to Azure: Run az login in your terminal.

  3. Install Java 17 or higher: Verify with java -version.

  4. Download the JAR file: Obtain the latest release from the GitHub Release page using the GitHub CLI:

    gh release download --repo jdubois/azure-cli-mcp --pattern='azure-cli-mcp.jar'

Integration with VS Code

  1. Install GitHub Copilot.
  2. Install the MCP Server using the VS Code command palette (MCP: Add Server...).
    • Configure the server to connect using the stio transport.
    • Set the command to run as java -jar ~/Downloads/azure-cli-mcp.jar (adjust the path to your downloaded JAR file).
  3. Enable Agent mode in GitHub Copilot.
  4. Verify that the azure-cli-mcp server is listed as a tool in the chat window.

Integration with Claude Desktop

Add the server configuration to your claude_desktop_config.json file:

{ "mcpServers": { "azure-cli": { "command": "java", "args": [ "-jar", "~/Downloads/azure-cli-mcp.jar" ] } } }

Smithery.ai Installation

Install the MCP server directly through Smithery.ai:

smithery badge

Important Considerations:

  • You will need to provide your AZURE_CREDENTIALS key to Smithery.ai.
  • Smithery.ai is a third-party service; ensure you trust them to build and host the MCP server.
  • This is an early preview service, and its future evolution is subject to change.

Visit More

View All