Skip to main content

Azure MCP Agent for secure, compliant resource deployment

Project description

Azure MCP Agent (Custom)

This repository contains a custom MCP server (server.py) exposing tools to:

  1. List active Azure role assignments for the signed-in user.
  2. List Azure resources (subscription-wide or specific resource group).
  3. Deploy resources via Bicep-backed PowerShell scripts (storage account, key vault, Azure OpenAI, AI Search, AI Foundry).

Prerequisites

Python Setup

cd "c:\Users\v-siddjha\OneDrive - MAQ Software\Desktop\agent"
python -m venv .venv
. .venv\Scripts\Activate.ps1
pip install -r requirements.txt

Run MCP Server Directly

python server.py

This starts the MCP process that tools (e.g., GitHub Copilot Agent) can attach to.

Configure GitHub Copilot to Use This MCP Server

In VS Code settings (JSON view), add an MCP server entry. Example:

"github.copilot.mcpServers": {
  "azure-agent": {
    "command": "python",
    "args": [
      "c:/Users/v-siddjha/OneDrive - MAQ Software/Desktop/agent/server.py"
    ],
    "env": {
      "PYTHONUNBUFFERED": "1"
    }
  }
}

Restart VS Code or Copilot Agent session. Copilot should list available tools (azure_login, list_permissions, list_resources, get_resource_parameters, deploy_resource).

Tool Usage (Within Copilot Chat)

  • List permissions:
    • Prompt: Call tool list_permissions (optionally pass user_principal_name or out_file).
  • List resources (all):
    • Prompt: Call tool list_resources.
  • List resources for RG:
    • Prompt: Call tool list_resources {"resource_group_name":"my-rg"}.
  • Discover required params for deployment:
    • Prompt: Call tool get_resource_parameters {"resource_type":"storage-account"}.
  • Deploy a resource (must supply required params):
    • Prompt: Call tool deploy_resource {"resource_type":"storage-account","parameters":{"ResourceGroupName":"my-rg","StorageAccountName":"mystorage123","Location":"eastus","AccessTier":"Hot"}}.

Local Test Harness (Without Copilot)

Run the included script:

python test_agent.py

Uncomment the deployment section and fill real parameter values before testing resource creation.

Adding New Deployment Scripts

  1. Place new deploy-*.ps1 in scripts/.
  2. Add a Bicep template in templates/.
  3. Extend DEPLOYMENT_SCRIPTS in server.py with logical key -> script filename.
  4. Use get_resource_parameters to see inferred required params.

Notes on Parameter Validation

deploy_resource infers required parameters by detecting if (-not $Param) prompts in the script. Ensure each truly required input has that pattern for stricter enforcement.

Common Issues

  • Azure CLI not found: Install CLI and restart shell.
  • Not logged in: Run az login.
  • Missing permissions: Confirm role assignments (e.g., Reader, Contributor) with list_permissions tool output.
  • Deployment failures: Check Bicep template, naming constraints, region availability.

Security Considerations

  • Do not hardcode secrets; use Key Vault deployment then store secrets securely.
  • Validate user-supplied parameters before passing to scripts if exposing externally.

Cleanup

To remove test resources, use Azure Portal or az group delete -n <RGName> --no-wait --yes.


Happy building! Use the Copilot Agent chat to invoke tools interactively.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_sfi_agent-1.0.10.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

azure_sfi_agent-1.0.10-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file azure_sfi_agent-1.0.10.tar.gz.

File metadata

  • Download URL: azure_sfi_agent-1.0.10.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for azure_sfi_agent-1.0.10.tar.gz
Algorithm Hash digest
SHA256 821d909e81eb54aaef209e6b043f9754e9f873b8df12d33f86be45e8fa1e74d7
MD5 773e2adad1c7d20a1454f273552a0e71
BLAKE2b-256 2f00fb8572efafe242580fd1ff061180a8b5b6bb9639446c64409f71147aaab6

See more details on using hashes here.

File details

Details for the file azure_sfi_agent-1.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_sfi_agent-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a3da7446d3c0dab015dcc2ae46d06a73f5c85504482f3371cdce5e116d7634c0
MD5 236e0ff143cab3246d232c4cb1930f99
BLAKE2b-256 47727172372c5565863dca70b1b4303a146e2bbafbe8f40dda4be4c4c1800153

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page