{Monitor} z monitor sli: Onboard SLI CRUD command group (Microsoft.Monitor 2025-03-01-preview)#33432
{Monitor} z monitor sli: Onboard SLI CRUD command group (Microsoft.Monitor 2025-03-01-preview)#33432saleelpk wants to merge 2 commits into
Conversation
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Hi @saleelpk, |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
…onitor 2025-03-01-preview)
Adds new 'az monitor sli' command group (create/show/list/update/delete) targeting the tenant-scoped Microsoft.Monitor SLI resource under serviceGroups, generated from typespec via aaz-dev.
Notes:
- Only user-assigned managed identity is supported; system-assigned is not exposed.
- The peer sli-signal-preview operation in the same swagger tag is intentionally not exposed via CLI.
- For future regenerations of monitoringservice, prefer the aaz-dev workspace flow ('aaz-dev run') over 'command-model generate-from-swagger' so peer resources (pipeline-group, signal-preview) aren't re-touched.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds the new preview az monitor sli command group backed by Microsoft.Monitor 2025-03-01-preview, along with scenario coverage and recordings.
Changes:
- Introduce AAZ-generated
monitor slicommands (create,show,list,update,delete) and command-group help. - Add live-recordable scenario tests for CRUD and UAMI rotation plus VCR recordings.
- Document the new command group in
HISTORY.rst.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_sli_scenario.py | Adds scenario tests for az monitor sli CRUD + UAMI rotation workflows. |
| src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_sli_uami_rotation.yaml | Adds recording data for the UAMI rotation scenario. |
| src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_sli_crud.yaml | Adds recording data for the CRUD scenario. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/sli/_create.py | Adds generated implementation for az monitor sli create. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/sli/_show.py | Adds generated implementation for az monitor sli show. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/sli/_list.py | Adds generated implementation for az monitor sli list. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/sli/_update.py | Adds generated implementation + help text for az monitor sli update. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/sli/_delete.py | Adds generated implementation for az monitor sli delete. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/sli/__cmd_group.py | Adds command-group registration and higher-level help on identity invariants. |
| src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/sli/init.py | Adds generated package init for the new CLI surface. |
| src/azure-cli/HISTORY.rst | Adds release-note entry describing the new az monitor sli commands and identity rotation guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.cmd( | ||
| "monitor sli create --service-group-name {sg} --sli-name {sli} " | ||
| "--category Latency --evaluation-type RequestBased " | ||
| "--description 'CLI SLI scenario test' --enable-alert false " | ||
| "--user-assigned {uami_id} " | ||
| "--destination-amw-accounts '{destination_amw_accounts}' " | ||
| "--baseline-properties '{baseline}' --sli-properties '{sli_properties}'", |
There was a problem hiding this comment.
Verified that azure.cli.testsdk's ScenarioTest invokes commands via shlex.split(command) with the default posix=True regardless of OS (src/azure-cli-testsdk/azure/cli/testsdk/base.py:303). With posix-mode shlex, single quotes are real quote characters on Windows too, so the JSON payloads are parsed correctly — the playback test passes on Windows (confirmed by azdev test on win32). Leaving the single-quoted style as it matches the dominant pattern elsewhere in azure-cli (e.g., backup module tests).
| good_signal_source = _build_signal_source(self.kwargs["uami_id"], self.kwargs["amw_id"]) | ||
| total_signal_source = dict(good_signal_source) |
There was a problem hiding this comment.
Switched the two signal sources from a dict(...) shallow copy to two independent _build_signal_source(...) calls and gave the totalSignals source a distinct signalSourceId (B) and matching signalFormula. Removed the footgun entirely. (commit 2f52a89)
| code: 500 | ||
| message: Internal Server Error |
There was a problem hiding this comment.
Stripped the two transient 500 DELETE interactions from test_monitor_sli_uami_rotation.yaml, leaving only the successful 200. The playback test still passes since VCR default matchers don't include the request body or count — the SDK issues one DELETE in playback and gets the recorded 200 directly. (commit 2f52a89)
| "/subscriptions/{sub}/resourcegroups/mfrei/providers/" | ||
| "Microsoft.ManagedIdentity/userAssignedIdentities/mfrei-test-user-managed-identity" |
There was a problem hiding this comment.
Renamed the default templates to neutral placeholders: service group → cli-test-sli-sg, RG → cli-test-sli-rg, UAMIs → cli-test-sli-uami / cli-test-sli-uami-2, AMW → cli-test-sli-amw, metric/namespace → cliTestMetric1 / cliTestNamespace. Both cassettes were scrubbed to match. The AZURE_CLI_TEST_SLI_* env-var overrides remain so live re-recording against any real resources still works. (commit 2f52a89)
# Conflicts: # src/azure-cli/HISTORY.rst
What this PR does
nnAdds newaz monitor slicommand group (create/show/list/update/delete) targeting the tenant-scoped Microsoft.Monitor SLI resource under serviceGroups, generated from typespec via aaz-dev.nn- API version:2025-03-01-preview(Microsoft.Monitor, monitoringservice)n- Scope: tenant (/providers/microsoft.management/serviceGroups/{}/providers/microsoft.monitor/slis/{})n- aaz models PR: https://github.com/Azure/aaz/pull/new/monitor-sli (linked separately)nn## Design notesnn- Only user-assigned managed identity (UAMI) is supported. The SLI service does not support system-assigned identity; we do not expose it.n- The same set of UAMIs must be referenced consistently across three places in the resource body (identity.userAssignedIdentities, everydestinationAmwAccounts[].identity, and every signal source'ssourceAmwAccountManagedIdentity). Rotation is done in a singleaz monitor sli update --set/--add/--removeinvocation; the recipe is inaz monitor sli --help.n- The peersli-signal-previewoperation in the same swagger tag is intentionally not exposed via CLI, now or in the future.n- A dedicatedmonitor sli identitysubgroup is intentionally **not** exposed; rotation is performed via generic update to keep the three identity refs consistent in a single PATCH.nn## Testingnn-azdev linter --include-whl-extensions monitor-> PASSEDn-azdev test test_monitor_sli_crud(playback) -> PASSED in 3.06sn- Live cassette recorded end-to-end on subscription 6820e35f-... with a real filter (operator: eq,samplingType: Count`)