Repository navigation
[Batch] az batch account identity assign, az batch account identity remove: Fix public network access being turned on - #34452
Merged
xuming-ms merged 2 commits intoNov 19, 2026
Conversation
Contributor
|
Thank you for your contribution Keyan Song (@mskeyansong)! We will review the pull request and get back to you soon. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change preserving Batch account network-access settings during identity updates.
No open issues 🎉
What changed in this PR
This PR fixes Batch account identity commands unintentionally enabling public network access, while preserving the existing behavior of network-profile commands.
Changes:
- Identity assign/remove updates omit public network access, preserving the account’s setting.
- Network-profile set explicitly enables public network access; help documents this behavior for set and network-rule add/delete.
- Mocked-client regression tests check the serialized updates sent by these commands.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/batch/tests/latest/test_batch_mgmt_commands.py |
Adds regression tests for public network access behavior. |
src/azure-cli/azure/cli/command_modules/batch/custom.py |
Preserves network access during identity updates and makes network-profile enablement explicit. |
src/azure-cli/azure/cli/command_modules/batch/_help.py |
Documents that network-profile commands enable public network access. |
Review effort: Balanced
Contributor
|
Hi Keyan Song (@mskeyansong), |
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
`az batch account identity assign` and `az batch account identity remove` send `publicNetworkAccess: Enabled` in the account update, because azure-mgmt-batch fills in 'Enabled' when it isn't set. The new test runs the identity and network profile commands with the management client mocked and checks the update they send. The identity commands fail it until the next commit; the network profile commands keep setting 'Enabled'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…y remove`: Don't turn public network access on These commands sent `publicNetworkAccess: Enabled` in the account update, because azure-mgmt-batch fills in 'Enabled' when it isn't set. On an account with public network access disabled, they turned it back on. They now leave it as it is. `az batch account network-profile set` and `az batch account network-profile network-rule add/delete` keep setting it to Enabled, because the network profile only takes effect when public network access is enabled. `network-profile set` now sets it explicitly instead of through the SDK's default, and the help of the three commands says so. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keyan Song (mskeyansong)
force-pushed
the
keyan/batch-fix-identity-public-network-access
branch
from
November 18, 2026 23:21
f43a619 to
511027f
Compare
xuming-ms
approved these changes
Nov 19, 2026
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 PR Validation — ️✔️ All clear
Related command
az batch account identity assign,az batch account identity remove,az batch account network-profile setDescription
az batch account identity assignandremovesendpublicNetworkAccess: Enabledwith the identity, because azure-mgmt-batch fills inEnabledwhen the value isn't set. So on an account with public network access disabled, they turn it back on. They now send no value, and the account keeps its setting.az batch account network-profile setandnetwork-rule add/deletekeep setting it toEnabled, because the network profile only takes effect when public network access is enabled.network-profile setnow sets it itself instead of through the SDK's default (the request doesn't change), and the help of the three commands says so.ADO: https://msazure.visualstudio.com/AzureBatch/_workitems/edit/40702063
Testing Guide
TestBatchAccountPublicNetworkAccessruns the commands with the management client mocked, on an account with public network access disabled, and checks the update they send. The identity commands fail it ondev.dev: only the two identity ones changed.azdev test batch(75 passed),azdev style batch,azdev linter batch.History Notes
[Batch]
az batch account identity assign,az batch account identity remove: Fix public network access being turned onThis 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.