Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,29 @@ interface MetricAlertResources {
* Retrieve an alert rule definition.
*/
@tag("MetricAlerts")
get is ArmResourceRead<MetricAlertResource, Error = MetricAlertErrorResponse>;
get is ArmResourceRead<
MetricAlertResource,
Error = Microsoft.Common.ErrorResponse
>;

/**
* Create or update an metric alert definition.
* Create or update a metric alert definition.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@tag("MetricAlerts")
createOrUpdate is ArmResourceCreateOrReplaceSync<
MetricAlertResource,
Response = ArmResourceUpdatedResponse<MetricAlertResource>,
Error = MetricAlertErrorResponse
Error = Microsoft.Common.ErrorResponse
>;

/**
* Update an metric alert definition.
* Update a metric alert definition.
*/
@patch(#{ implicitOptionality: false })
@tag("MetricAlerts")
update is ArmCustomPatchSync<
MetricAlertResource,
PatchModel = MetricAlertResourcePatch,
Error = MetricAlertErrorResponse
Error = Microsoft.Common.ErrorResponse
>;

/**
Expand All @@ -96,7 +97,7 @@ interface MetricAlertResources {
@tag("MetricAlerts")
delete is ArmResourceDeleteSync<
MetricAlertResource,
Error = MetricAlertErrorResponse
Error = Microsoft.Common.ErrorResponse
>;

/**
Expand All @@ -106,7 +107,7 @@ interface MetricAlertResources {
listByResourceGroup is ArmResourceListByParent<
MetricAlertResource,
Response = ArmResponse<MetricAlertResourceCollection>,
Error = MetricAlertErrorResponse
Error = Microsoft.Common.ErrorResponse
>;

/**
Expand All @@ -116,7 +117,7 @@ interface MetricAlertResources {
listBySubscription is ArmListBySubscription<
MetricAlertResource,
Response = ArmResponse<MetricAlertResourceCollection>,
Error = MetricAlertErrorResponse
Error = Microsoft.Common.ErrorResponse
>;

/**
Expand All @@ -136,7 +137,7 @@ interface MetricAlertResources {
@segment("metricAlerts")
ruleName: string;
},
Error = MetricAlertErrorResponse
Error = Microsoft.Common.ErrorResponse
>;

/**
Expand All @@ -155,7 +156,7 @@ interface MetricAlertResources {
@segment("status")
statusName: string;
},
OverrideErrorType = MetricAlertErrorResponse
OverrideErrorType = Microsoft.Common.ErrorResponse
>;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{

Check failure on line 1 in specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/UpdateMetricAlert.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/UpdateMetricAlert.json#L1

specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/UpdateMetricAlert.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/UpdateMetricAlert.json
"parameters": {
"api-version": "2026-01-01",
"parameters": {
"properties": {
"description": "This is the description of the rule1",
"actions": [
{
"actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
],
"autoMitigate": true,
"criteria": {
"allOf": [
{
"name": "High_CPU_80",
"criterionType": "StaticThresholdCriterion",
"dimensions": [],
"metricName": "\\Processor(_Total)\\% Processor Time",
"operator": "GreaterThan",
"threshold": 80.5,
"timeAggregation": "Average"
}
],
"odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
},
"enabled": true,
"evaluationFrequency": "PT1M",
"scopes": [
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
],
"severity": 3,
"windowSize": "PT15M"
},
"tags": {}
},
"resourceGroupName": "gigtest",
"ruleName": "chiricutin",
"subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"
},
"responses": {
"200": {
"body": {
"type": "Microsoft.Insights/metricAlerts",
"id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
"location": "global",
"properties": {
"description": "This is the description of the rule1",
"actions": [
{
"actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
],
"autoMitigate": true,
"criteria": {
"allOf": [
{
"name": "High_CPU_80",
"criterionType": "StaticThresholdCriterion",
"dimensions": [],
"metricName": "\\Processor(_Total)\\% Processor Time",
"operator": "GreaterThan",
"threshold": 80.5,
"timeAggregation": "Average"
}
],
"odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
},
"enabled": true,
"evaluationFrequency": "PT1M",
"scopes": [
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
],
"severity": 3,
"windowSize": "PT15M"
},
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
}
},
"headers": {}
}
},
"operationId": "MetricAlerts_Update",
"title": "Create or update an alert rule"
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{

Check failure on line 1 in specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/createOrUpdateDynamicMetricAlertMultipleResource.json

View check run for this annotation

Azure Pipelines / Swagger PrettierCheck

specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/createOrUpdateDynamicMetricAlertMultipleResource.json#L1

specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/createOrUpdateDynamicMetricAlertMultipleResource.json(1,1): error : Code style issues found, please run prettier. > npm install > npx prettier --write specification/monitor/resource-manager/Microsoft.Insights/Insights/MetricAlertApi/examples/2026-01-01/createOrUpdateDynamicMetricAlertMultipleResource.json
"parameters": {
"api-version": "2026-01-01",
"parameters": {
"location": "global",
"properties": {
"description": "This is the description of the rule1",
"actions": [
{
"actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
],
"autoMitigate": true,
"criteria": {
"allOf": [
{
"name": "High_CPU_80",
"alertSensitivity": "Medium",
"criterionType": "DynamicThresholdCriterion",
"dimensions": [],
"failingPeriods": {
"minFailingPeriodsToAlert": 4,
"numberOfEvaluationPeriods": 4
},
"metricName": "Percentage CPU",
"metricNamespace": "microsoft.compute/virtualmachines",
"operator": "GreaterOrLessThan",
"timeAggregation": "Average"
}
],
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"
},
"enabled": true,
"evaluationFrequency": "PT1M",
"scopes": [
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
],
"severity": 3,
"targetResourceRegion": "southcentralus",
"targetResourceType": "Microsoft.Compute/virtualMachines",
"windowSize": "PT15M"
},
"tags": {}
},
"resourceGroupName": "gigtest",
"ruleName": "MetricAlertOnMultipleResources",
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"type": "Microsoft.Insights/metricAlerts",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources",
"location": "global",
"properties": {
"description": "This is the description of the rule1",
"actions": [
{
"actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
],
"autoMitigate": true,
"criteria": {
"allOf": [
{
"name": "High_CPU_80",
"alertSensitivity": "Medium",
"criterionType": "DynamicThresholdCriterion",
"dimensions": [],
"failingPeriods": {
"minFailingPeriodsToAlert": 4,
"numberOfEvaluationPeriods": 4
},
"metricName": "Percentage CPU",
"metricNamespace": "microsoft.compute/virtualmachines",
"operator": "GreaterOrLessThan",
"timeAggregation": "Average"
}
],
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"
},
"enabled": true,
"evaluationFrequency": "PT1M",
"scopes": [
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
],
"severity": 3,
"targetResourceRegion": "southcentralus",
"targetResourceType": "Microsoft.Compute/virtualMachines",
"windowSize": "PT15M"
},
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
}
},
"headers": {}
}
},
"operationId": "MetricAlerts_CreateOrUpdate",
"title": "Create or update a dynamic alert rule for Multiple Resources"
}

Loading
Loading