Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions infra/services/monitor.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,22 @@ resource tableServiceDiagnostics 'Microsoft.Insights/diagnosticSettings@2021-05-
]
}
}

// Role assignment for the test application to access the storage account
resource blobContributorRoleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
scope: subscription()
// This is the Storage Blob Data Contributor role.
// Read, write, and delete Azure Storage containers and blobs
// See https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#storage
name: 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
}

resource appBlobRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(blobContributorRoleDefinition.id, testApplicationOid, storageAccount.id)
scope: storageAccount
properties:{
principalId: testApplicationOid
roleDefinitionId: blobContributorRoleDefinition.id
description: 'Blob Contributor for testApplicationOid'
}
}
65 changes: 33 additions & 32 deletions infra/services/workbooks.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -351,36 +351,37 @@ resource simpleTestWorkbook 'Microsoft.Insights/workbooks@2023-06-01' = {
}

// User workbook for testing different kind
resource userWorkbook 'Microsoft.Insights/workbooks@2023-06-01' = {
name: guid('${baseName}-user-workbook')
location: location
kind: 'user'
properties: {
displayName: '${baseName} User Workbook'
description: 'User workbook for testing different kind filter'
category: 'workbook'
sourceId: workspace.id
serializedData: string({
version: 'Notebook/1.0'
items: [
{
type: 1
content: {
json: '# User Workbook\n\nThis is a user workbook for testing kind filters.'
}
}
]
styleSettings: {}
'$schema': 'https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json'
})
}
tags: {
purpose: 'testing'
environment: 'development'
project: 'azure-mcp'
category: 'filter-test'
}
}
// TODO: kind'user' is unsupported. The only valid value is 'shared'.
// resource userWorkbook 'Microsoft.Insights/workbooks@2023-06-01' = {
// name: guid('${baseName}-user-workbook')
// location: location
// kind: 'user'
// properties: {
// displayName: '${baseName} User Workbook'
// description: 'User workbook for testing different kind filter'
// category: 'workbook'
// sourceId: workspace.id
// serializedData: string({
// version: 'Notebook/1.0'
// items: [
// {
// type: 1
// content: {
// json: '# User Workbook\n\nThis is a user workbook for testing kind filters.'
// }
// }
// ]
// styleSettings: {}
// '$schema': 'https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json'
// })
// }
// tags: {
// purpose: 'testing'
// environment: 'development'
// project: 'azure-mcp'
// category: 'filter-test'
// }
// }

// Sentinel workbook for testing different category
resource sentinelWorkbook 'Microsoft.Insights/workbooks@2023-06-01' = {
Expand Down Expand Up @@ -452,7 +453,7 @@ output performanceWorkbookId string = performanceWorkbook.id
output securityWorkbookId string = securityWorkbook.id
output applicationInsightsWorkbookId string = applicationInsightsWorkbook.id
output simpleTestWorkbookId string = simpleTestWorkbook.id
output userWorkbookId string = userWorkbook.id
//output userWorkbookId string = userWorkbook.id
output sentinelWorkbookId string = sentinelWorkbook.id
output tsgWorkbookId string = tsgWorkbook.id

Expand All @@ -462,7 +463,7 @@ output workbookNames array = [
securityWorkbook.properties.displayName
applicationInsightsWorkbook.properties.displayName
simpleTestWorkbook.properties.displayName
userWorkbook.properties.displayName
//userWorkbook.properties.displayName
sentinelWorkbook.properties.displayName
tsgWorkbook.properties.displayName
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task Should_list_loadtests()
{
// Arrange
var result = await CallToolAsync(
"azmcp-loadtesting-testresource-list",
"azmcp_loadtesting_testresource_list",
new()
{
{ "subscription", _subscriptionId },
Expand All @@ -33,7 +33,7 @@ public async Task Should_list_loadtests()
});

// Assert
var items = result.AssertProperty("LoadTests");
var items = result.AssertProperty("LoadTest");
Assert.Equal(JsonValueKind.Array, items.ValueKind);
Assert.NotEmpty(items.EnumerateArray());
foreach (var item in items.EnumerateArray())
Expand Down
18 changes: 9 additions & 9 deletions tests/Areas/Marketplace/LiveTests/MarketplaceCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task Should_get_marketplace_product()

// Act
var result = await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId },
Expand Down Expand Up @@ -78,7 +78,7 @@ public async Task Should_get_marketplace_product_with_language_option()

// Act
var result = await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId },
Expand All @@ -104,7 +104,7 @@ public async Task Should_get_marketplace_product_with_market_option()

// Act
var result = await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId },
Expand All @@ -129,7 +129,7 @@ public async Task Should_get_marketplace_product_with_include_hidden_plans()

// Act
var result = await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId },
Expand Down Expand Up @@ -161,7 +161,7 @@ public async Task Should_get_marketplace_product_with_service_instruction_templa

// Act
var result = await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId },
Expand All @@ -188,7 +188,7 @@ public async Task Should_handle_nonexistent_product_gracefully()
var exception = await Assert.ThrowsAnyAsync<Exception>(async () =>
{
await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId },
Expand All @@ -211,7 +211,7 @@ public async Task Should_validate_required_subscription_parameter()
var exception = await Assert.ThrowsAnyAsync<Exception>(async () =>
{
await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "product-id", productId }
Expand All @@ -230,7 +230,7 @@ public async Task Should_validate_required_product_id_parameter()
var exception = await Assert.ThrowsAnyAsync<Exception>(async () =>
{
await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId }
Expand All @@ -252,7 +252,7 @@ public async Task Should_get_marketplace_product_with_multiple_options()

// Act
var result = await CallToolAsync(
"azmcp-marketplace-product-get",
"azmcp_marketplace_product_get",
new()
{
{ "subscription", _subscriptionId },
Expand Down
13 changes: 7 additions & 6 deletions tests/Areas/Monitor/LiveTests/MonitorCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class MonitorCommandTests(LiveTestFixture fixture, ITestOutputHelper outp
private LogAnalyticsHelper? _logHelper;
private const string TestLogType = "TestLogs_CL";
private IMonitorService? _monitorService;
private string _storageAccountName = $"{fixture.Settings.ResourceBaseName}mon";
Comment thread
hallipr marked this conversation as resolved.

ValueTask IAsyncLifetime.InitializeAsync()
{
Expand Down Expand Up @@ -82,7 +83,7 @@ public async Task Should_list_monitor_workspaces()
Assert.NotEmpty(array);
}

[Fact]
[Fact(Skip = "Intermittent failures due to slow ingestion")]
Comment thread
vcolin7 marked this conversation as resolved.
[Trait("Category", "Live")]
public async Task Should_get_table_contents()
{
Expand Down Expand Up @@ -169,7 +170,7 @@ public async Task Should_list_monitor_table_types()
[Trait("Category", "Live")]
public async Task Should_query_monitor_logs_by_resource_id()
{
var storageResourceId = $"/subscriptions/{Settings.SubscriptionId}/resourceGroups/{Settings.ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{Settings.ResourceBaseName}";
var storageResourceId = $"/subscriptions/{Settings.SubscriptionId}/resourceGroups/{Settings.ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{_storageAccountName}";
await QueryForLogsAsync(
async args => await CallToolAsync("azmcp_monitor_resource_log_query", args),
new()
Expand Down Expand Up @@ -275,7 +276,7 @@ private static async Task QueryForLogsAsync(
public async Task Should_list_metric_definitions()
{
// Example resource ID - uses a storage account that should exist from the test fixture
string resourceId = $"/subscriptions/{Settings.SubscriptionId}/resourceGroups/{Settings.ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{Settings.ResourceBaseName}";
string resourceId = $"/subscriptions/{Settings.SubscriptionId}/resourceGroups/{Settings.ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{_storageAccountName}";

var result = await CallToolAsync(
"azmcp_monitor_metrics_definitions",
Expand Down Expand Up @@ -347,7 +348,7 @@ public async Task Should_list_metric_definitions()
public async Task Should_query_metrics()
{
// Example resource ID - uses a storage account that should exist from the test fixture
string resourceId = $"/subscriptions/{Settings.SubscriptionId}/resourceGroups/{Settings.ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{Settings.ResourceBaseName}";
string resourceId = $"/subscriptions/{Settings.SubscriptionId}/resourceGroups/{Settings.ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{_storageAccountName}";

var result = await CallToolAsync(
"azmcp_monitor_metrics_query",
Expand Down Expand Up @@ -413,7 +414,7 @@ private async Task GenerateStorageActivityAsync()
var listResult = await CallToolAsync("azmcp_storage_blob_container_list", new()
{
{ "subscription", Settings.SubscriptionId },
{ "account-name", Settings.ResourceBaseName }
{ "account-name", _storageAccountName }
});

Output.WriteLine("Listed storage containers to generate metrics");
Expand All @@ -428,7 +429,7 @@ private async Task GenerateStorageActivityAsync()
var blobListResult = await CallToolAsync("azmcp_storage_blob_list", new()
{
{ "subscription", Settings.SubscriptionId },
{ "account-name", Settings.ResourceBaseName },
{ "account-name", _storageAccountName },
{ "container-name", containerName.GetString() }
});

Expand Down
Loading