Open AlyaKoni opened 10 months ago
@JoyerJin did we touch this cmdlet in the latest version of Az.Monitor? If not, please look into this issue. Thanks.
Hi Yeming,
We did not change this cmdlet.
Now the cmdlet api version is 2021-08-01, it is an old version. Azure Portal is using version 2023-03-15-preview. The managed identity for alert rule is preview feature. Could you check with service team?
Here is request and response:
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.Insights/scheduledQueryRules/test-rule-joyer?api-version=2021-08-01
Headers:
x-ms-unique-id : 8
x-ms-client-request-id : 1a367593-5510-47c6-a182-e4190412d4c1
CommandName : Update-AzScheduledQueryRule
FullCommandName : Update-AzScheduledQueryRule_UpdateExpanded
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v11.0.0,PSVersion/v7.3.9,Az.ScheduledQueryRule/5.0.0
Body:
{
"properties": {
"description": "triggers",
"displayName": "test",
"enabled": true,
"scopes": [
"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.Compute/virtualMachines/test-vm"
]
}
}
DEBUG: 2:26:05 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: BeforeCall:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-request-id : d9f9126b-f411-4ce1-96e6-1226f6cbe3f7
x-ms-correlation-request-id : d9f9126b-f411-4ce1-96e6-1226f6cbe3f7
x-ms-routing-request-id : JAPANEAST:20231117T062609Z:d9f9126b-f411-4ce1-96e6-1226f6cbe3f7
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: D7BA4EF5DE0D418899F96F6315B6C16E Ref B: TYO201100114029 Ref C: 2023-11-17T06:26:03Z
Date : Fri, 17 Nov 2023 06:26:08 GMT
Body:
{
"id": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/microsoft.insights/scheduledqueryrules/test-rule-joyer",
"name": "test-rule-joyer",
"type": "microsoft.insights/scheduledqueryrules",
"location": "eastus",
"systemData": {
"createdBy": "v-jiaji@microsoft.com",
"createdByType": "User",
"createdAt": "2023-11-17T06:24:57.5350349Z",
"lastModifiedBy": "v-jiaji@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2023-11-17T06:26:03.7117592Z"
},
"properties": {
"createdWithApiVersion": "2021-08-01",
"displayName": "test",
"description": "triggers",
"severity": 4,
"enabled": true,
"evaluationFrequency": "PT5M",
"scopes": [
"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps1-test/providers/Microsoft.Compute/virtualMachines/test-vm"
],
"windowSize": "PT10M",
"criteria": {
"allOf": [
{
"query": "Perf | where ObjectName == \"Processor\" and CounterName == \"% Processor Time\" | summarize AggregatedValue = avg(CounterValue) by bin(TimeGenerated, 5m), Computer",
"timeAggregation": "Average",
"metricMeasureColumn": "AggregatedValue",
"dimensions": [
{
"name": "Computer",
"operator": "Include",
"values": [
"*"
]
}
],
"operator": "GreaterThan",
"threshold": 70.0,
"failingPeriods": {
"numberOfEvaluationPeriods": 1,
"minFailingPeriodsToAlert": 1
}
}
]
}
}
}
Thanks, Joyer
As @JoyerJin showed, the Update-AzScheduledQueryRule
cmdlet sent a PATCH API to perform a partial update, which should not impact the other properties such as managed identity. I'll loop in service team to identify if this is a bug.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzmonAlerts.
Description
I have a already defined alert rule with a system assigned maanged identity. Now I like to update the rule with Update-AzScheduledQueryRule. The update works without any error and the rule is correctly updated. May the system assigned maanged identity is removed from the alert rule.
Issue script & Debug output
Environment data
Module versions
Error output