Skip to content

[Storage] WIP: align CLI with storage TypeSpec migration - #33310

Draft
Libba Lawrence (l0lawrence) wants to merge 1 commit into
Azure:devfrom
l0lawrence:storage-tsp-cli-fixes
Draft

Libba Lawrence (l0lawrence) wants to merge 1 commit into
Azure:devfrom
l0lawrence:storage-tsp-cli-fixes

Conversation

@l0lawrence

Copy link
Copy Markdown
Member

WIP / Draft — companion changes for the Azure Storage TypeSpec migration in azure-sdk-for-python.

The TSP-generated SDK renames the internal generated-enums module from _azure_blob_storage_enums.py / _azure_file_storage_enums.py to _enums.py, and consolidates the legacy AccessTierOptional enum into AccessTier. The CLI reaches into these private _generated.* paths via cmd.get_models(...) so it must be updated to follow the new layout.

Changes

  • _params.py — 6 lookups updated to _generated.models._enums#X; AccessTierOptionalAccessTier
  • _validators.py — 2 lookups updated to _generated.models._enums#X

Tracks SDK PRs:

Update generated enum module path (_azure_*_storage_enums -> _enums) and consolidate AccessTierOptional into AccessTier to match the storage TypeSpec migration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

@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

github-actions Bot commented May 1, 2026

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>

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.

🟡 Changes recommended

Update the SDK dependency pins or retain compatibility fallbacks, and restrict tier choices for standard blob commands.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates Storage CLI enum lookups for the TypeSpec-generated Azure Storage SDK layout.

Changes:

  • Migrates blob and file-share lookups to _generated.models._enums.
  • Replaces AccessTierOptional with AccessTier.
  • Updates page-blob tier validation.
File summaries
File Review summary
src/azure-cli/azure/cli/command_modules/storage/_params.py Updated enum lookups, but current SDK pins still use the old module paths. AccessTier also permits tiers invalid for standard blob rewrite commands.
src/azure-cli/azure/cli/command_modules/storage/_validators.py Updated page-blob tier lookup, but the current blob SDK pin causes valid tier values to be rejected.
Review details

Suppressed comments (2)

src/azure-cli/azure/cli/command_modules/storage/_params.py:231

  • AccessTier is broader than the enum previously used here: the migrated SDK class includes Premium (and Smart), while the old AccessTierOptional did not. This shared tier_type is also used for storage blob rewrite's standard_blob_tier argument, where Premium is not a valid standard tier, so --tier Premium will now pass CLI parsing and be sent as an invalid standard tier. Keep command-specific choices or filter the values for the standard-tier commands.
    t_blob_tier = self.get_sdk('_generated.models._enums#AccessTier',
                               resource_type=ResourceType.DATA_STORAGE_BLOB)

src/azure-cli/azure/cli/command_modules/storage/_params.py:1934

  • The file-share dependency remains pinned to azure-storage-file-share==12.25.0b1, whose generated package still contains _azure_file_storage_enums.py rather than _enums.py. Consequently get_sdk returns None for this lookup (and the later ModeCopyMode/OwnerCopyMode lookups), so those arguments are registered without enum types until the matching migrated SDK is pinned.
        t_delete_snapshot = self.get_sdk('_generated.models._enums#DeleteSnapshotsOptionType',
                                         resource_type=ResourceType.DATA_STORAGE_FILESHARE)
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 1402 to +1403
namespace.premium_page_blob_tier = getattr(cmd.get_models(
'_generated.models._azure_blob_storage_enums#PremiumPageBlobAccessTier'), namespace.tier)
'_generated.models._enums#PremiumPageBlobAccessTier'), namespace.tier)
Comment on lines +232 to 233
t_rehydrate_priority = self.get_sdk('_generated.models._enums#RehydratePriority',
resource_type=ResourceType.DATA_STORAGE_BLOB)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants