Skip to content

{Monitor} z monitor sli: Onboard SLI CRUD command group (Microsoft.Monitor 2025-03-01-preview)#33432

Open
saleelpk wants to merge 2 commits into
Azure:devfrom
saleelpk:monitor-sli
Open

{Monitor} z monitor sli: Onboard SLI CRUD command group (Microsoft.Monitor 2025-03-01-preview)#33432
saleelpk wants to merge 2 commits into
Azure:devfrom
saleelpk:monitor-sli

Conversation

@saleelpk
Copy link
Copy Markdown

What this PR doesnnAdds 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.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, every destinationAmwAccounts[].identity, and every signal source's sourceAmwAccountManagedIdentity). Rotation is done in a single az monitor sli update --set/--add/--removeinvocation; the recipe is inaz monitor sli --help.n- The peer sli-signal-preview operation in the same swagger tag is intentionally not exposed via CLI, now or in the future.n- A dedicated monitor sli identity subgroup 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`)

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @saleelpk,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 23, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

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).
After that please run the following commands to enable git hooks:

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>
@saleelpk saleelpk marked this pull request as ready for review May 26, 2026 19:41
Copilot AI review requested due to automatic review settings May 26, 2026 19:41
@saleelpk saleelpk requested review from bebound and jiasli as code owners May 26, 2026 19:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sli commands (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.

Comment on lines +120 to +126
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}'",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment on lines +99 to +100
good_signal_source = _build_signal_source(self.kwargs["uami_id"], self.kwargs["amw_id"])
total_signal_source = dict(good_signal_source)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment on lines +280 to +281
code: 500
message: Internal Server Error
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment on lines +45 to +46
"/subscriptions/{sub}/resourcegroups/mfrei/providers/"
"Microsoft.ManagedIdentity/userAssignedIdentities/mfrei-test-user-managed-identity"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants