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:
- List active Azure role assignments for the signed-in user.
- List Azure resources (subscription-wide or specific resource group).
- Deploy resources via Bicep-backed PowerShell scripts (storage account, key vault, Azure OpenAI, AI Search, AI Foundry).
Prerequisites
- Windows + PowerShell (
pwsh) recommended. - Python 3.10+ installed.
- Azure CLI installed: https://learn.microsoft.com/cli/azure/install-azure-cli
- Logged in to Azure:
az login --use-device-code(or normalaz login). - Appropriate RBAC permissions to list and deploy resources.
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 passuser_principal_nameorout_file).
- Prompt:
- List resources (all):
- Prompt:
Call tool list_resources.
- Prompt:
- List resources for RG:
- Prompt:
Call tool list_resources {"resource_group_name":"my-rg"}.
- Prompt:
- Discover required params for deployment:
- Prompt:
Call tool get_resource_parameters {"resource_type":"storage-account"}.
- Prompt:
- 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"}}.
- Prompt:
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
- Place new
deploy-*.ps1inscripts/. - Add a Bicep template in
templates/. - Extend
DEPLOYMENT_SCRIPTSinserver.pywith logical key -> script filename. - Use
get_resource_parametersto 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: Runaz login.- Missing permissions: Confirm role assignments (e.g., Reader, Contributor) with
list_permissionstool 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file azure_sfi_agent-1.0.4.tar.gz.
File metadata
- Download URL: azure_sfi_agent-1.0.4.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed57bd0b0480c7b2ad69b37a1c9463c455d3f4a244476d2dcc0e06a481fb08a8
|
|
| MD5 |
a231f1713672ca188dc0e43852f709fe
|
|
| BLAKE2b-256 |
2d01428db00d89c93197242236f2f451c40a144e7537d1a2006c98e7a30b6c5e
|
File details
Details for the file azure_sfi_agent-1.0.4-py3-none-any.whl.
File metadata
- Download URL: azure_sfi_agent-1.0.4-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eaec342b7464f980b178631973f4119ed3bacc2ae22deeb2506e714c0487cb1
|
|
| MD5 |
3b691217bab35a76d49c59c562a87735
|
|
| BLAKE2b-256 |
7a73f28df3644168d5de3d4070e72395bb5d34075d5b9f336e59aff01701363e
|