Some checks failed
check agents / check (push) Failing after 12s
azure-discovery, aws-discovery and gcp-discovery collect read-only metadata on servers, workloads, Kubernetes clusters, networks, data stores, policies and provider recommendations. Credentials arrive per call from the vault. Replies are paged, scrubbed of secrets and anonymised, and throttled calls back off. cloud-knowledge searches each provider's Well-Architected guidance from fixed lists only, so no customer detail can leave the platform. Adds shared skills, the render and test tooling, a public Python Dockerfile until the hardened base image is reachable, the customer access guide, the implementation plan and the Vault Service platform issue. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
243 lines
10 KiB
YAML
243 lines
10 KiB
YAML
# Read-only discovery of a customer's Azure estate. Render with scripts/render_mcp_server.py.
|
|
# Credentials arrive per call from the Vault Service. Store them per project, never tenant-wide.
|
|
|
|
server_id: azure-discovery
|
|
name: Azure Discovery
|
|
description: Read-only discovery of a customer's Azure estate - servers, workloads, Kubernetes clusters, networks,
|
|
data stores, policies and Advisor findings - through Azure Resource Graph.
|
|
version: 0.1.2
|
|
port: 8111
|
|
verify_tool: azure_check_connection
|
|
shared_code:
|
|
- _common/tool_support.py
|
|
- _common/azure_support.py
|
|
connection_fields:
|
|
- name: tenant_id
|
|
title: Tenant ID
|
|
description: The customer's Microsoft Entra tenant id.
|
|
required: false
|
|
secret: false
|
|
- name: client_id
|
|
title: Client ID
|
|
description: The application (client) id of the read-only app registration.
|
|
required: false
|
|
secret: false
|
|
- name: client_secret
|
|
title: Client secret
|
|
description: The app registration's client secret.
|
|
required: false
|
|
secret: true
|
|
- name: access_token
|
|
title: Access token
|
|
description: For a short trial only, instead of the three fields above. A token from az account get-access-token. It expires within about an hour and carries that person's own Azure permissions.
|
|
required: false
|
|
secret: true
|
|
- name: scope_root
|
|
title: Scope root
|
|
description: 'What may be read: managementGroups/<id> or subscriptions/<id>.'
|
|
required: true
|
|
secret: false
|
|
- name: cloud
|
|
title: Cloud
|
|
description: public, usgov or china. Default public.
|
|
required: false
|
|
secret: false
|
|
tools:
|
|
- name: azure_check_connection
|
|
display_name: Check connection
|
|
description: 'Test the stored connection: sign in and read the scope root. Returns no customer data.'
|
|
parameters: []
|
|
ai_implementation: |
|
|
async def azure_check_connection(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
try:
|
|
body = await _azure_graph("ResourceContainers | summarize count()", 1)
|
|
except Exception as error:
|
|
return {"ok": False, "message": _upstream_failed("azure", error)["error"]["message"]}
|
|
return {"ok": True, "message": "Signed in and read the scope root."}
|
|
- name: azure_list_accounts
|
|
display_name: List accounts
|
|
description: 'List the estate structure: management groups, subscriptions and resource groups.'
|
|
parameters:
|
|
- name: kind
|
|
type: string
|
|
description: 'One of: subscriptions, management_groups, resource_groups.'
|
|
required: false
|
|
- &id001
|
|
name: page_size
|
|
type: integer
|
|
description: Items per page, up to 200. Default 50.
|
|
required: false
|
|
- &id002
|
|
name: page_token
|
|
type: string
|
|
description: next_page_token from the previous reply.
|
|
required: false
|
|
ai_implementation: |
|
|
async def azure_list_accounts(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
kinds = {"subscriptions": ["microsoft.resources/subscriptions"], "management_groups": ["microsoft.management/managementgroups"], "resource_groups": ["microsoft.resources/subscriptions/resourcegroups"]}
|
|
return await _azure_kind("azure_list_accounts", arguments, kinds, "ResourceContainers", "subscriptions")
|
|
- name: azure_list_resources
|
|
display_name: List resources
|
|
description: List every resource in scope, or one resource type, with id, type, location and tags.
|
|
parameters:
|
|
- name: resource_type
|
|
type: string
|
|
description: Optional ARM type, such as microsoft.compute/virtualmachines.
|
|
required: false
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_list_resources(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
kind = arguments.get("resource_type")
|
|
if kind and not re.fullmatch(r"[A-Za-z0-9./]+", str(kind)):
|
|
return _refuse("invalid_argument", "resource_type must be an ARM type")
|
|
where = f" | where type =~ '{kind}'" if kind else ""
|
|
return await _azure_page("azure_list_resources", arguments, f"Resources{where} | project id, name, type, location, resourceGroup, subscriptionId, tags | order by id asc")
|
|
- name: azure_query_resources
|
|
display_name: Query resources
|
|
description: Run a read-only Azure Resource Graph KQL query over the connection's scope. Secrets and people are
|
|
removed from the results.
|
|
parameters:
|
|
- name: query
|
|
type: string
|
|
description: KQL starting with a Resource Graph table.
|
|
required: true
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_query_resources(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
query = str(arguments.get("query") or "").strip()
|
|
if not query or len(query) > 4000:
|
|
return _refuse("invalid_argument", "query is required, up to 4000 characters")
|
|
if query.split("|")[0].strip().lower() not in AZURE_TABLES:
|
|
return _refuse("invalid_argument", "query must start with one of: " + ", ".join(AZURE_TABLES))
|
|
return await _azure_page("azure_query_resources", arguments, query)
|
|
- name: azure_get_resource_metadata
|
|
display_name: Get resource metadata
|
|
description: Read-only provider metadata for one resource inside the connection's scope.
|
|
parameters:
|
|
- name: resource_id
|
|
type: string
|
|
description: The full ARM resource id.
|
|
required: true
|
|
- name: scope_entry_id
|
|
type: string
|
|
description: The scope entry this answers, echoed in the reply.
|
|
required: false
|
|
ai_implementation: |
|
|
async def azure_get_resource_metadata(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
resource_id = str(arguments.get("resource_id") or "")
|
|
if not re.fullmatch(r"/subscriptions/[A-Za-z0-9\-]+(/[A-Za-z0-9._()\-]+)+", resource_id):
|
|
return _refuse("invalid_argument", "resource_id must be a full ARM resource id")
|
|
try:
|
|
body = await _azure_graph(f"Resources | where id =~ '{resource_id}'", 1)
|
|
except Exception as error:
|
|
return _upstream_failed("azure", error)
|
|
if not body.get("data"):
|
|
return _refuse("outside_scope", "no such resource inside this connection's scope")
|
|
return _one_result("azure", "azure_get_resource_metadata", arguments, body["data"][0])
|
|
- name: azure_list_servers
|
|
display_name: List servers
|
|
description: List virtual machines, scale sets or managed disks.
|
|
parameters:
|
|
- name: kind
|
|
type: string
|
|
description: 'One of: virtual_machines, scale_sets, disks.'
|
|
required: false
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_list_servers(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
return await _azure_kind("azure_list_servers", arguments, AZURE_SERVERS)
|
|
- name: azure_list_workloads
|
|
display_name: List workloads
|
|
description: List App Service, Container Apps or Container Instances workloads.
|
|
parameters:
|
|
- name: kind
|
|
type: string
|
|
description: 'One of: app_service, container_apps, container_instances.'
|
|
required: false
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_list_workloads(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
return await _azure_kind("azure_list_workloads", arguments, AZURE_WORKLOADS)
|
|
- name: azure_list_kubernetes_clusters
|
|
display_name: List Kubernetes clusters
|
|
description: List AKS clusters with version, node pools and networking. Stops at the cloud control plane.
|
|
parameters: &id003
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_list_kubernetes_clusters(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
return await _azure_kind("azure_list_kubernetes_clusters", arguments, AZURE_KUBERNETES)
|
|
- name: azure_get_network_topology
|
|
display_name: Get network topology
|
|
description: List virtual networks with their subnets and peerings, or route tables, NSGs, gateways, load balancers,
|
|
private endpoints or public IPs.
|
|
parameters:
|
|
- name: kind
|
|
type: string
|
|
description: 'One of: virtual_networks, route_tables, network_security_groups, gateways, load_balancers, private_endpoints,
|
|
public_ips.'
|
|
required: false
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_get_network_topology(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
return await _azure_kind("azure_get_network_topology", arguments, AZURE_NETWORK)
|
|
- name: azure_list_data_stores
|
|
display_name: List data stores
|
|
description: List SQL, Cosmos DB or storage account metadata. Never rows, documents or blobs.
|
|
parameters:
|
|
- name: kind
|
|
type: string
|
|
description: 'One of: sql, cosmos_db, storage_accounts.'
|
|
required: false
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_list_data_stores(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
return await _azure_kind("azure_list_data_stores", arguments, AZURE_DATA)
|
|
- name: azure_list_organization_policies
|
|
display_name: List organization policies
|
|
description: List Azure Policy assignments, definitions, initiatives, exemptions or compliance states.
|
|
parameters:
|
|
- name: kind
|
|
type: string
|
|
description: 'One of: assignments, definitions, initiatives, exemptions, compliance.'
|
|
required: false
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_list_organization_policies(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
return await _azure_kind("azure_list_organization_policies", arguments, AZURE_ORG_POLICIES, "PolicyResources", "assignments")
|
|
- name: azure_list_resource_policies
|
|
display_name: List resource policies
|
|
description: List Key Vault access policies (never secret values), storage network rules or resource locks. Principals
|
|
are anonymised.
|
|
parameters:
|
|
- name: subscription_id
|
|
type: string
|
|
description: For resource_locks. Needed when the scope root is a management group.
|
|
required: false
|
|
- name: kind
|
|
type: string
|
|
description: 'One of: key_vault_access, storage_network_rules, resource_locks.'
|
|
required: false
|
|
- *id001
|
|
- *id002
|
|
ai_implementation: |
|
|
async def azure_list_resource_policies(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
if arguments.get("kind") == "resource_locks":
|
|
return await _azure_locks("azure_list_resource_policies", arguments)
|
|
return await _azure_kind("azure_list_resource_policies", arguments, AZURE_RESOURCE_POLICIES)
|
|
- name: azure_list_recommendations
|
|
display_name: List recommendations
|
|
description: List Azure Advisor recommendations, each with a common Well-Architected pillar.
|
|
parameters: *id003
|
|
ai_implementation: |
|
|
async def azure_list_recommendations(arguments: Dict[str, Any]) -> Dict[str, Any]:
|
|
query = "AdvisorResources | where type =~ 'microsoft.advisor/recommendations' | order by id asc"
|
|
return await _azure_page("azure_list_recommendations", arguments, query, _azure_recommendation)
|