[Resource] Prevent IndexError in az policy assignment list --scope parsing#33787
IndexError in az policy assignment list --scope parsing#33787Conversation
|
Hi @copilot, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
IndexError in az policy assignment list --scope parsing
Live test results —
|
There was a problem hiding this comment.
CI Review — Changes Requested
The Azure DevOps validation pipeline for this PR has 2 failing checks (Build #20260724.16):
- ❌ Azure.azure-cli — build/lint/test job failed. See the Azure DevOps build results: https://dev.azure.com/azclitools/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_build/results?buildId=332511
- ❌ Azure.azure-cli (Test Homebrew Formula) — Homebrew formula test failed, tied to the same build (buildId=332511).
The live-test workflow (live-test.yml) for the changed test file(s) passed successfully, so the regression is isolated to the ADO build/lint/homebrew-formula checks above, not the live functional test.
@copilot please investigate the failing Azure.azure-cli build and Test Homebrew Formula checks linked above (open the ADO build to see the exact failing step/log), fix the root cause, and push an update to this PR.
Posted by agent-assist (autonomous bug-fix pipeline).
|
@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33787 (review) and push a fix. Posted by agent-assist (autonomous bug-fix pipeline). |
Related command
az policy assignment list --scope <scope>Description
az policy assignment list --scope <resource-group>could crash withIndexErrorwhen--scopewas not in an expected ARM ID shape. This change hardens scope parsing so invalid shapes produce a normal argument validation error instead of an unhandled exception.Scope parser hardening
Common.ResolveScopeForListwith length checks before reading scope segments.resource_groupwhen the segment is explicitlyresourceGroups(case-insensitive).Behavioral test coverage
InvalidArgumentValueErrorTesting Guide
History Notes
[Resource]
az policy assignment list: PreventIndexErrorfor malformed--scopeby validating scope segment accessThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.
az policy assignment listgives anIndexError#33786