Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@
"words": [
"1espt",
"aarch",
"accesspolicy",
"acaenvironment",
"activitylog",
"accesspolicy",
"adminprovider",
"agentic",
"aieval",
Expand All @@ -280,11 +280,12 @@
"alcoop",
"amlfs",
"aoai",
"apos",
"apim",
"apos",
"appconfig",
"applens",
"appservice",
"apptrace",
"aspnetcore",
"australiacentral",
"australiaeast",
Expand Down Expand Up @@ -387,6 +388,7 @@
"datasources",
"dataverse",
"dbforpostgresql",
"dcount",
"deallocate",
"debugtelemetry",
"deregistering",
Expand Down Expand Up @@ -435,6 +437,8 @@
"hostpools",
"idempotency",
"idtyp",
"ifexists",
"IKQL",
"indonesiacentral",
"infile",
"intelli",
Expand All @@ -453,6 +457,7 @@
"kusto",
"kvps",
"lakehouse",
"leftouter",
"liftr",
"ligar",
"linkedservices",
Expand Down Expand Up @@ -500,8 +505,8 @@
"northeurope",
"norwayeast",
"norwaywest",
"npmjs",
"npgsql",
"npmjs",
"nupkg",
"nuxt",
"occured",
Expand All @@ -518,8 +523,8 @@
"paygo",
"persistable",
"pgrep",
"piechart",
"pids",
"piechart",
"polandcentral",
"portalsettings",
"predeploy",
Expand All @@ -538,6 +543,7 @@
"resourcehealth",
"RESTAPI",
"rhvm",
"rightouter",
"rulesets",
"runtimes",
"searchdocs",
Expand Down Expand Up @@ -581,8 +587,11 @@
"tfvars",
"timechart",
"timespan",
"todouble",
"toint",
"toolset",
"toolsets",
"toscalar",
"typespec",
"uaenorth",
"uksouth",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public static bool TryGetValue<T>(this CommandResult commandResult, string optio
return TryGetValue(commandResult, option, out value);
}

/// <summary>
/// Gets the value of the specified option, returning default if not found or not set.
/// </summary>
public static T? GetValueOrDefault<T>(this CommandResult commandResult, Option<T> option)
{
ArgumentNullException.ThrowIfNull(commandResult);
Expand Down Expand Up @@ -140,6 +143,9 @@ public static bool TryGetValue<T>(this CommandResult commandResult, string optio
return optionResult.GetValueOrDefault<T>();
}

/// <summary>
/// Gets the value of the option with the first matched option name, returning default if not found or not set.
/// </summary>
public static T? GetValueOrDefault<T>(this CommandResult commandResult, string optionName)
{
// Find the option by name in the command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Azure.Core;
using Azure.Mcp.Core.Options;

namespace Azure.Mcp.Tools.Monitor.Services;
namespace Azure.Mcp.Core.Services.Azure.Resource;

/// <summary>
/// Service interface for resolving Azure resource identifiers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

using Azure.Core;
using Azure.Mcp.Core.Options;
using Azure.Mcp.Core.Services.Azure;
using Azure.Mcp.Core.Services.Azure.Subscription;
using Azure.Mcp.Core.Services.Azure.Tenant;

namespace Azure.Mcp.Tools.Monitor.Services;
namespace Azure.Mcp.Core.Services.Azure.Resource;

public class ResourceResolverService(ISubscriptionService subscriptionService, ITenantService tenantService)
: BaseAzureService(tenantService), IResourceResolverService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
using System.Text.Json;
using Azure.Core;
using Azure.Mcp.Core.Options;
using Azure.Mcp.Core.Services.Azure.Resource;
using Azure.Mcp.Core.Services.Azure.Subscription;
using Azure.Mcp.Core.Services.Azure.Tenant;
using Azure.Mcp.Tools.Monitor.Services;
using Azure.ResourceManager.Resources;
using NSubstitute;
using Xunit;

namespace Azure.Mcp.Tools.Monitor.UnitTests.Metrics;
namespace Azure.Mcp.Core.UnitTests.Services.Azure;

public class ResourceResolverServiceTests
{
Expand Down
1 change: 1 addition & 0 deletions servers/Azure.Mcp.Server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The Azure MCP Server updates automatically by default whenever a new release com

- Added Azure AI Best Practices toolset providing comprehensive guidance for building AI apps with Azure AI Foundry and Microsoft Agent Framework. Includes model selection guidance, SDK recommendations, and implementation patterns for agent development. [[#1031](https://github.com/microsoft/mcp/pull/1031)]
- Added support for text-to-speech synthesis via the command `speech_tts_synthesize`. [[#902](https://github.com/microsoft/mcp/pull/902)]
- Added support for listing Application Insights distributed trace metadata via the command `azmcp_applicationinsights_apptrace_list` [[#671](https://github.com/microsoft/mcp/issues/671)]

### Breaking Changes

Expand Down
16 changes: 12 additions & 4 deletions servers/Azure.Mcp.Server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ All Azure MCP tools in a single server. The Azure MCP Server implements the [MCP
<!-- remove-section: start nuget;npm remove_ide_sub_section -->
Install Azure MCP Server using either an IDE extension or package manager. Choose one method below.

> [!IMPORTANT]
> [!IMPORTANT]
> Authenticate to Azure before running the Azure MCP server. See the [Authentication guide](https://github.com/microsoft/mcp/blob/main/docs/Authentication.md) for authentication methods and instructions.

## IDE
Expand All @@ -123,7 +123,7 @@ Compatible with both the [Stable](https://code.visualstudio.com/download) and [I
- If Visual Studio 2026 is already installed, open the **Visual Studio Installer** and select the **Modify** button, which displays the available workloads.
1. On the Workloads tab, select **Azure and AI development** and select **GitHub Copilot**.
1. Click **install while downloading** to complete the installation.

For more information, visit [Install GitHub Copilot for Azure in Visual Studio 2026](https://aka.ms/ghcp4a/vs2026)

### Visual Studio 2022
Expand Down Expand Up @@ -235,7 +235,7 @@ Install the .NET Tool: [Azure.Mcp](https://www.nuget.org/packages/Azure.Mcp).
```bash
dotnet tool install Azure.Mcp
```
or
or
```bash
dotnet tool install Azure.Mcp --version <version>
```
Expand Down Expand Up @@ -365,7 +365,7 @@ To use Azure Entra ID, review the [troubleshooting guide](https://github.com/mic
* Create AI Foundry agent threads
* List AI Foundry agent threads
* Get messages of an AI Foundry thread

### 🔎 Azure AI Search

* "What indexes do I have in my Azure AI Search service 'mysvc'?"
Expand Down Expand Up @@ -397,6 +397,13 @@ To use Azure Entra ID, review the [troubleshooting guide](https://github.com/mic
* "Get the details for website 'my-website'"
* "Get the details for app service plan 'my-app-service-plan'"

### 📈 Azure Application Insights

* "List Application Insights traces for app 'my-ai-app' over the last hour"
* "List Application Insights trace metadata for app 'my-ai-app' in resource group 'rg-observability'"
* "Show trace metadata for my Application Insights component 'my-ai-app' using the requests table"
* "List Application Insights recommendations in my subscription"

### 🖥️ Azure CLI Generate

* Generate Azure CLI commands based on user intent
Expand Down Expand Up @@ -525,6 +532,7 @@ The Azure MCP Server provides tools for interacting with **40+ Azure service are
- 🤖 **Azure AI Best Practices** - AI app development guidance for Azure AI Foundry and Microsoft Agent Framework
- ⚙️ **Azure App Configuration** - Configuration management
- 🕸️ **Azure App Service** - Web app hosting
- 📈 **Azure Application Insights** - Distributed trace metadata & performance recommendations
- 🛡️ **Azure Best Practices** - Secure, production-grade guidance
- 🖥️ **Azure CLI Generate** - Generate Azure CLI commands from natural language
- 📞 **Azure Communication Services** - SMS messaging and communication
Expand Down
32 changes: 30 additions & 2 deletions servers/Azure.Mcp.Server/docs/azmcp-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ azmcp server start \

#### Specific Tool Filtering

Exposes only specific tools by name, providing the finest level of granularity. The `--namespace` and `--tool` options cannot be used together. Use multiple `--tool` parameters to include multiple tools. Using `--tool` automatically switches to `all` mode.
Exposes only specific tools by name, providing the finest level of granularity. The `--namespace` and `--tool` options cannot be used together. Use multiple `--tool` parameters to include multiple tools. Using `--tool` automatically switches to `all` mode.

```bash
# Start MCP Server with default mode and only subscription and resource group tools
Expand Down Expand Up @@ -567,6 +567,34 @@ azmcp applicationinsights recommendation list --subscription <subscription> \
--resource-group <resource-group>
```

#### Distributed Trace

List distributed trace metadata (request/exception/dependency/availability) for a specific Application Insights component. This returns a summarized set of rows containing timestamps, operation/span identifiers, and table source information that you can use to further drill into telemetry.

```bash
# List request trace metadata for an Application Insights component by resource name
azmcp applicationinsights apptrace list --subscription <subscription> \
--resource-group <resource-group> \
--resource-name <app-insights-name> \
--table requests \
--start-time 2025-01-01T00:00:00Z \
--end-time 2025-01-01T01:00:00Z

# Same query using a full resource ID and the exceptions table
azmcp applicationinsights apptrace list --subscription <subscription> \
--resource-id /subscriptions/<sub>/resourceGroups/<rg>/providers/microsoft.insights/components/<name> \
--table exceptions

# List availability result traces with an optional filter (multiple --filters allowed)
azmcp applicationinsights apptrace list --subscription <subscription> \
--resource-group <resource-group> \
--resource-name <app-insights-name> \
--table availabilityResults \
--filters "durationMs > 1000"
```

Supported tables: `requests`, `exceptions`, `dependencies`, `availabilityResults`.

### Azure App Service Operations

```bash
Expand Down Expand Up @@ -1654,7 +1682,7 @@ azmcp monitor webtests update --subscription <subscription> \
# List Azure Managed Lustre Filesystems available in a subscription or resource group
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp managedlustre fs list --subscription <subscription> \
--resource-group <resource-group>
--resource-group <resource-group>

# Create an Azure Managed Lustre filesystem
# ✅ Destructive | ❌ Idempotent | ❌ OpenWorld | ❌ ReadOnly | ❌ Secret | ❌ LocalRequired
Expand Down
6 changes: 6 additions & 0 deletions servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ This file contains prompts used for end-to-end testing to ensure each tool is in
| applicationinsights_recommendation_list | Show me code optimization recommendations for all Application Insights resources in my subscription |
| applicationinsights_recommendation_list | List profiler recommendations for Application Insights in resource group <resource_group_name> |
| applicationinsights_recommendation_list | Show me performance improvement recommendations from Application Insights |
| applicationinsights_apptrace_list | List Application Insights trace metadata for app <app_insights_name> in resource group <resource_group_name> from <start_time> to <end_time> |
| applicationinsights_apptrace_list | Show trace metadata for Application Insights component <resource_id> using the requests table |
| applicationinsights_apptrace_list | List Application Insights traces for app <app_insights_name> over the last hour |
| applicationinsights_apptrace_list | List dependency traces for Application Insights app <app_insights_name> in resource group <resource_group_name> between <start_time> and <end_time> |
| applicationinsights_apptrace_list | Get availability result trace metadata for Application Insights app <app_insights_name> between <start_time> and <end_time> |
| applicationinsights_apptrace_list | List exception trace metadata for Application Insights app <app_insights_name> in resource group <resource_group_name> |

## Azure CLI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Azure.Mcp.Core.Areas;
using Azure.Mcp.Core.Commands;
using Azure.Mcp.Core.Extensions;
using Azure.Mcp.Core.Services.Azure.Resource;
using Azure.Mcp.Tools.ApplicationInsights.Commands.AppTrace;
using Azure.Mcp.Tools.ApplicationInsights.Commands.Recommendation;
using Azure.Mcp.Tools.ApplicationInsights.Services;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -25,26 +27,35 @@ public void ConfigureServices(IServiceCollection services)

// Service for accessing Profiler dataplane.
services.AddSingleton<IProfilerDataService, ProfilerDataService>();

services.AddSingleton<IResourceResolverService, ResourceResolverService>();
services.AddSingleton<IKQLQueryBuilder>(_ => KQLQueryBuilder.Instance);
services.AddSingleton<IAppLogsQueryService, AppLogsQueryService>();
services.AddSingleton<IApplicationInsightsService, ApplicationInsightsService>();

services.AddSingleton<RecommendationListCommand>();
services.AddSingleton<AppTraceListCommand>();
}

public CommandGroup RegisterCommands(IServiceProvider serviceProvider)
{
var group = new CommandGroup(Name,
"""
Application Insights operations - Commands for listing and managing Application Insights components.
Application Insights operations - Commands for listing and managing Application Insights components.
These commands do not support querying metrics or logs. Use Azure Monitor querying tools for that purpose.
""",
Title);

var recommendation = new CommandGroup("recommendation", "Application Insights recommendation operations - list recommendation targets (components).");
group.AddSubGroup(recommendation);
var recommendationGroup = new CommandGroup("recommendation", "Application Insights recommendation operations - list recommendation targets (components).");
group.AddSubGroup(recommendationGroup);

var appInsightsGroup = new CommandGroup("apptrace", "Application Insights trace operations - list traces and spans for components.");
group.AddSubGroup(appInsightsGroup);

var recommendationList = serviceProvider.GetRequiredService<RecommendationListCommand>();
recommendation.AddCommand(recommendationList.Name, recommendationList);
recommendationGroup.AddCommand(recommendationList.Name, recommendationList);

var appTraceList = serviceProvider.GetRequiredService<AppTraceListCommand>();
appInsightsGroup.AddCommand(appTraceList.Name, appTraceList);

return group;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Monitor.Query" />
<PackageReference Include="Azure.ResourceManager" />
<PackageReference Include="Azure.ResourceManager.ApplicationInsights" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
Expand Down
Loading
Loading