report_impact_to_azure
Report customer-facing Azure infrastructure issues to Microsoft by submitting impact reports with subscription, resource, and category details through the Azure Management API.
Instructions
Reports the impact to Azure. Typically called when customers facing issue with azure infrastructure and they want to let azure know about it.
Args: subscriptionid (str): The Azure subscription ID where the resource is present. Eg: 68fa15fd-eef2-4ca3-a053-bcf268bd7371 resourcegroup (str): The Azure resource group name where the resource is present. Eg: test-rg resourceprovider (str): The Azure resource provider name for the resource. Eg: Microsoft.Compute resourcetype (str): The Azure resource type. Eg: virtualMachines resourcename (str): The Azure resource name. Eg: test-vm impactcategory (str): The impact category denoting the underlying issue. Can be one of: Resource.Connectivity, Resource.Performance, Resource.Availability or Resource.Unknown if the issue is not known.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subscriptionid | Yes | ||
| resourcegroup | Yes | ||
| resourceprovider | Yes | ||
| resourcetype | Yes | ||
| resourcename | Yes | ||
| impactcategory | Yes |
Implementation Reference
- impact-reporter.py:48-62 (handler)The main handler function for the 'report_impact_to_azure' tool. It is registered via the @mcp.tool() decorator and delegates the core logic to the 'call_impactrp' helper function. The function signature provides the input schema with parameter annotations and detailed docstring.@mcp.tool() async def report_impact_to_azure(subscriptionid: str, resourcegroup: str, resourceprovider: str, resourcetype: str, resourcename: str, impactcategory: str) -> str: """Reports the impact to Azure. Typically called when customers facing issue with azure infrastructure and they want to let azure know about it. Args: subscriptionid (str): The Azure subscription ID where the resource is present. Eg: 68fa15fd-eef2-4ca3-a053-bcf268bd7371 resourcegroup (str): The Azure resource group name where the resource is present. Eg: test-rg resourceprovider (str): The Azure resource provider name for the resource. Eg: Microsoft.Compute resourcetype (str): The Azure resource type. Eg: virtualMachines resourcename (str): The Azure resource name. Eg: test-vm impactcategory (str): The impact category denoting the underlying issue. Can be one of: Resource.Connectivity, Resource.Performance, Resource.Availability or Resource.Unknown if the issue is not known. """ # Call the function to report impact to Azure response = await call_impactrp(subscriptionid, resourcegroup, resourceprovider, resourcetype, resourcename, impactcategory) return response
- impact-reporter.py:13-47 (helper)Supporting helper function that implements the core logic: constructs the Azure Impact Reporter API URL, payload, authenticates with DefaultAzureCredential, and makes an async PUT request to report the impact.async def call_impactrp(subscriptionid: str, resourcegroup: str, resourceprovider: str, resourcetype: str, resourcename: str, impactcategory: str) -> str: """Reports the impact to Azure. Typically called when customers facing issue with azure infrastructure and they want to let azure know about it.""" workload_impact_name = str(uuid.uuid4()) # Construct the URL for the impact report url = f"{IMPACT_REPORTER_BASE_URL}/subscriptions/{subscriptionid}/providers/Microsoft.Impact/workloadImpacts/{workload_impact_name}?api-version=2023-12-01-preview" impacted_resource_id = f"/subscriptions/{subscriptionid}/resourceGroups/{resourcegroup}/providers/{resourceprovider}/{resourcetype}/{resourcename}" # Create a JSON payload for the impact report payload = { "properties": { "impactCategory": f"{impactcategory}", "impactedResourceId": f"/subscriptions/{subscriptionid}/resourceGroups/{resourcegroup}/providers/{resourceprovider}/{resourcetype}/{resourcename}", "startDateTime": datetime.datetime.now(datetime.timezone.utc).isoformat() } } # Get the bearer token credential = DefaultAzureCredential() accessToken = credential.get_token("https://management.azure.com/.default") token = accessToken.token # Set up headers with the bearer token headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json" } async with httpx.AsyncClient(verify=False) as client: try: response = await client.put(url, headers=headers, json=payload, timeout=30.0) return json.dumps(response.json(), indent=2) except Exception as e: return f"Error reporting impact: {e}"
- impact-reporter.py:48-48 (registration)The @mcp.tool() decorator registers the 'report_impact_to_azure' function as an MCP tool.@mcp.tool()
- impact-reporter.py:49-59 (schema)Input schema derived from function parameters with type annotations and detailed Arg descriptions in docstring. FastMCP likely generates JSON Schema from this.async def report_impact_to_azure(subscriptionid: str, resourcegroup: str, resourceprovider: str, resourcetype: str, resourcename: str, impactcategory: str) -> str: """Reports the impact to Azure. Typically called when customers facing issue with azure infrastructure and they want to let azure know about it. Args: subscriptionid (str): The Azure subscription ID where the resource is present. Eg: 68fa15fd-eef2-4ca3-a053-bcf268bd7371 resourcegroup (str): The Azure resource group name where the resource is present. Eg: test-rg resourceprovider (str): The Azure resource provider name for the resource. Eg: Microsoft.Compute resourcetype (str): The Azure resource type. Eg: virtualMachines resourcename (str): The Azure resource name. Eg: test-vm impactcategory (str): The impact category denoting the underlying issue. Can be one of: Resource.Connectivity, Resource.Performance, Resource.Availability or Resource.Unknown if the issue is not known. """