Skip to content

[Storage] az storage account create/update: Add --zones and --zone-placement-policy to support setting zones and availability zone pinning policy - #32192

Merged
Zhiyi Huang (calvinhzy) merged 2 commits into
Azure:devfrom
calvinhzy:storage-zonal-placement-policy
Sep 29, 2025

Conversation

@calvinhzy

@calvinhzy Zhiyi Huang (calvinhzy) commented Sep 29, 2025 •

Copy link
Copy Markdown
Contributor

Related command

Description

Add --zones and --zone-placement-policy when creating/updating storage account to support setting zones and availability zone pinning policy

Testing Guide

History Notes

[Storage] az storage account create/update: Add --zones and --zone-placement-policy to support setting zones and availability zone pinning policy


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

…nt-policy`, zone-placement-policy testing fails now
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Sep 29, 2025 •

Copy link
Copy Markdown
️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Zhiyi Huang (@calvinhzy),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Sep 29, 2025 •

Copy link
Copy Markdown
⚠️AzureCLI-BreakingChangeTest
⚠️storage
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd storage account create cmd storage account create added parameter zone_placement_policy
⚠️ 1006 - ParaAdd storage account create cmd storage account create added parameter zones
⚠️ 1006 - ParaAdd storage account update cmd storage account update added parameter zone_placement_policy
⚠️ 1006 - ParaAdd storage account update cmd storage account update added parameter zones

@yonzhan

Copy link
Copy Markdown
Collaborator

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>

@calvinhzy
Zhiyi Huang (calvinhzy) marked this pull request as ready for review September 29, 2025 08:36
Copilot AI review requested due to automatic review settings September 29, 2025 08:36

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.

Pull Request Overview

This PR adds availability zone support to Azure Storage account commands by introducing two new parameters: --zones and --zone-placement-policy for both az storage account create and az storage account update commands.

  • Adds zone configuration options to enable availability zone support for storage accounts
  • Implements zone placement policy to control how storage accounts are distributed across availability zones
  • Includes comprehensive test coverage for both creation and update scenarios with zone configurations

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
_params.py Adds parameter definitions for --zones and --zone-placement-policy arguments
account.py Implements zone and placement policy handling in create/update operations
test_storage_account_scenarios.py Adds comprehensive test cases for zone and placement policy functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1831 to +1833
def test_storage_account_zone_with_placement(self):
self.kwargs.update({
'rg': 'yifantestzp',

Copilot AI Sep 29, 2025

Copy link

Choose a reason for hiding this comment

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

The hardcoded resource group name 'yifantestzp' appears to be a personal test resource group. This should be replaced with a dynamically created or properly named test resource group to ensure tests are portable and don't depend on specific environments.

Suggested change
def test_storage_account_zone_with_placement(self):
self.kwargs.update({
'rg': 'yifantestzp',
@ResourceGroupPreparer(name_prefix='cli_test_storage_zone_placement')
def test_storage_account_zone_with_placement(self, resource_group):
self.kwargs.update({
'rg': resource_group,

Copilot uses AI. Check for mistakes.
Comment on lines +325 to 328
t_account_type, t_sku_name, t_kind, t_tls_version, t_dns_endpoint_type, t_zone_placement_policy = \
self.get_models('AccountType', 'SkuName', 'Kind', 'MinimumTlsVersion', 'DnsEndpointType',
'ZonePlacementPolicy',
resource_type=ResourceType.MGMT_STORAGE)

Copilot AI Sep 29, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The tuple unpacking on line 325 is getting very long with 6 variables. Consider breaking this into multiple lines or using separate get_models calls for better readability and maintainability.

Suggested change
t_account_type, t_sku_name, t_kind, t_tls_version, t_dns_endpoint_type, t_zone_placement_policy = \
self.get_models('AccountType', 'SkuName', 'Kind', 'MinimumTlsVersion', 'DnsEndpointType',
'ZonePlacementPolicy',
resource_type=ResourceType.MGMT_STORAGE)
t_account_type = self.get_models('AccountType', resource_type=ResourceType.MGMT_STORAGE)
t_sku_name = self.get_models('SkuName', resource_type=ResourceType.MGMT_STORAGE)
t_kind = self.get_models('Kind', resource_type=ResourceType.MGMT_STORAGE)
t_tls_version = self.get_models('MinimumTlsVersion', resource_type=ResourceType.MGMT_STORAGE)
t_dns_endpoint_type = self.get_models('DnsEndpointType', resource_type=ResourceType.MGMT_STORAGE)
t_zone_placement_policy = self.get_models('ZonePlacementPolicy', resource_type=ResourceType.MGMT_STORAGE)

Copilot uses AI. Check for mistakes.
Comment on lines +538 to +539
c.argument('zones', nargs='+',
help='Describes the available zones for the product where storage account resource can be created.')

Copilot AI Sep 29, 2025

Copy link

Choose a reason for hiding this comment

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

The help text for 'zones' is duplicated between create and update contexts (lines 440-441 and 538-539). Consider extracting this to a constant to avoid duplication and ensure consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +540 to +541
c.argument('zone_placement_policy', arg_type=get_enum_type(t_zone_placement_policy),
help='The availability zone pinning policy for the storage account.')

Copilot AI Sep 29, 2025

Copy link

Choose a reason for hiding this comment

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

The help text for 'zones' is duplicated between create and update contexts (lines 440-441 and 538-539). Consider extracting this to a constant to avoid duplication and ensure consistency.

Copilot uses AI. Check for mistakes.
@calvinhzy
Zhiyi Huang (calvinhzy) merged commit b14f284 into Azure:dev Sep 29, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Storage az storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants