Skip to content

[Storage] Fix #34155: az storage blob list: Honor the configured storage service endpoint - #34176

Open
JunKai-v wants to merge 1 commit into
Azure:devfrom
JunKai-v:az-storage-blob-list-ignore-service-endpoint
Open

JunKai-v wants to merge 1 commit into
Azure:devfrom
JunKai-v:az-storage-blob-list-ignore-service-endpoint

Conversation

@JunKai-v

@JunKai-v JunKai-v commented Oct 6, 2026 •

Copy link
Copy Markdown

Fixes #34155

Related command
az storage blob list (and all storage data-plane commands using validate_client_parameters)

Description
The help text for --blob-endpoint (and other --*-endpoint args) documents AZURE_STORAGE_SERVICE_ENDPOINT, but validate_client_parameters reads config key storage.account_url, which maps to AZURE_STORAGE_ACCOUNT_URL. So the documented env var was ignored and requests fell back to the public cloud endpoint.

This PR reads storage.service_endpoint first, then falls back to storage.account_url, so:

  • AZURE_STORAGE_SERVICE_ENDPOINT now works as documented
  • AZURE_STORAGE_ACCOUNT_URL keeps working (no breaking change)
  • An explicit --blob-endpoint still takes precedence

Testing Guide

$env:AZURE_STORAGE_ACCOUNT="devstoreaccount1"
$env:AZURE_STORAGE_KEY=""
$env:AZURE_STORAGE_SERVICE_ENDPOINT="http://localhost:10000/devstoreaccount1"
az storage blob list --container-name container1 --auth-mode key --debug

Before: request goes to https://devstoreaccount1.blob.core.windows.net (403).
After: request goes to http://localhost:10000/devstoreaccount1.

Unit tests added in test_storage_validators.py (TestClientParametersValidator, 6 cases).

History Notes


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

@JunKai-v
JunKai-v requested a review from a team as a code owner October 6, 2026 08:08
Copilot AI balanced review requested due to automatic review settings October 6, 2026 08:08
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Copilot review overview

🟡 Changes recommended

An explicit account name still prevents the configured service endpoint from being loaded.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Updates storage client validation to honor AZURE_STORAGE_SERVICE_ENDPOINT, while retaining legacy endpoint support.

Changes:

  • Adds documented endpoint lookup with legacy fallback.
  • Adds validator tests for endpoint precedence and fallback behavior.
File Description
storage/​_validators.py Resolves configured storage service endpoints.
storage/​tests/​latest/​test_storage_validators.py Tests endpoint resolution and precedence.

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

Comment on lines +135 to +136
n.account_url = (get_config_value(cmd, 'storage', 'service_endpoint', None) or
get_config_value(cmd, 'storage', 'account_url', None))
validate_source_url,
validate_encryption_services, as_user_validator,
get_not_none_validator, validate_upload_blob)
get_not_none_validator, validate_upload_blob,
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

This branch has not been deployed

No deployments
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.

AZURE_STORAGE_SERVICE_ENDPOINT ignored by az storage blob list

5 participants