Skip to content

[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 into
Azure:devfrom
mskeyansong:keyan/batch-fix-identity-public-network-access
Nov 19, 2026
Merged

xuming-ms merged 2 commits into
Azure:devfrom
mskeyansong:keyan/batch-fix-identity-public-network-access

Conversation

@mskeyansong

@mskeyansong Keyan Song (mskeyansong) commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests Suppressions
️✔️ None ️✔️ 130/130 ️✔️ None

Related command
az batch account identity assign, az batch account identity remove, az batch account network-profile set

Description
az batch account identity assign and remove send publicNetworkAccess: Enabled with the identity, because azure-mgmt-batch fills in Enabled when 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 set and 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 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

  • New TestBatchAccountPublicNetworkAccess runs 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 on dev.
  • Request bodies of 7 cases compared with 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 on


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 06:42
@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Nov 18, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Keyan Song (@mskeyansong)! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Hi Keyan Song (@mskeyansong),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
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>
@mskeyansong
Keyan Song (mskeyansong) force-pushed the keyan/batch-fix-identity-public-network-access branch from f43a619 to 511027f Compare November 18, 2026 23:21
@xuming-ms
xuming-ms merged commit dc79208 into Azure:dev Nov 19, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad act-quality-productivity-squad Batch az batch customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants