Azure / Azure/azure-powershell
Update-AzScheduledQueryRule removed already defined system assigned maanged identity
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
### 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
```PowerShell
$null = Update-AzScheduledQueryRule -InputObject $alertRule.Id `
-DisplayName $AlertName `
-Description "Triggers an alert for the condition: $AlertText" `
-ActionGroupResourceId $ActionGroupId `
-Enabled:$true `
-Scope $LogAnaWrkspc.ResourceId `
-Severity $Severity `
-WindowSize ([System.TimeSpan]::FromMinutes($TimeWindowInMinutes)) `
-EvaluationFrequency ([System.TimeSpan]::FromMinutes($FrequencyInMinutes)) `
-CriterionAllOf $alertCondition
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.3.9
PSEdition Core
GitCommitId 7.3.9
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.13.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 4.6.0 Az.Monitor {Add-AzLogProfile, Add-AzMetricAlertRule, Add-AzMetricAlertRuleV2, Add-AzWebtest…
Script 3.2.0 Az.OperationalInsights {Disable-AzOperationalInsightsIISLogCollection, Disable-AzOperationalInsightsLin…
Script 6.11.2 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDepl…
```
### Error output
```PowerShell
N/A
```
Contributor guide
Research direction
Start with the Update-AzScheduledQueryRule implementation in Az.Monitor and reproduce the issue using the PowerShell script and the existing alert rule. Compare the rule's identity before and after the update, then verify the completed change preserves the system-assigned managed identity and add coverage for that update path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100