Repository navigation
[Compute] az vm/vmss identity assign: Avoid resending existing identities - #34433
Conversation
|
William (@william051200) No defect was confirmed in the inspected VM/VMSS identity-assignment paths. Upstream CI passed, but regression coverage for the restricted-caller scenario remains unverified by the available execution evidence. Review detailsUpstream CIThe handoff reports 52 completed, successful checks and no failures. Test validation
The inspected tests represent the intended conditions: the caller can write the compute resource and assign identity B, but cannot assign existing identity A. The request change sends only requested identities rather than resending existing ones. In Inspection limit: Production changes, planned test excerpts and the restricted-caller recording were inspected; full inspection of the six other changed recordings was not completed: Risk assessment31/100 · Medium The Medium rating is driven by public CLI behavior.
Ask the Agent Tick a box to queue an action. Requires write access to this repository.
|
There was a problem hiding this comment.
🟡 Changes recommended
Inherited schema caching can bypass the extended VM and VMSS patch schemas, causing identity assignment to fail because identity_type is missing.
1 open issue
What changed in this PR
This PR addresses #34422 by making az vm/vmss identity assign submit only requested user-assigned identities, avoiding permission checks on unrelated identities already attached.
Changes:
- Shares assignment-argument logic while preserving the existing identity type.
- Extends VM and VMSS PATCH operations to retain combined identity types without resending existing identities.
- Adds serialized-request unit tests and live preservation scenarios, and refreshes existing test configurations.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py |
Adds live identity-preservation checks and updates scenario configurations. |
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py |
Tests requested-only PATCH payloads and identity-type preservation. |
src/azure-cli/azure/cli/command_modules/vm/operations/vmss.py |
Adds an internal identity-type override for VMSS PATCH requests. |
src/azure-cli/azure/cli/command_modules/vm/operations/vm.py |
Adds an internal identity-type override for VM PATCH requests. |
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Centralizes assignment arguments and stops including untouched identities. |
Review effort: Balanced
|
|
||
|
|
||
| class VMPatch(_VMPatch): | ||
| @classmethod |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
William (@william051200) Please fix the CI failures first. Details are under Upstream CI in the review. See the X Engineering Agent Report.
5f1b7ae to
83afe1b
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |

🤖 PR Validation — ️✔️ All clear
Related command
az vm/vmss identity assignDescription
Resolve #34422
Identity assignment resends every attached user-assigned identity, causing
LinkedAuthorizationFailedwhen the caller can assign the requested identity but lacks assignment permission on unrelated existing identities.Testing Guide
python -m pytest src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_custom_vm_commands.py::TestIdentityAssignmentazdev test test_vm_identity_assign_preserves_existing_identities test_vmss_identity_assign_preserves_existing_identities --liveHistory Notes
[Compute]
az vm/vmss identity assign: Fix unnecessary assignment-permission checks on existing user-assigned identities by submitting only requested identitiesThis 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.