Skip to content

Session provider sync implementation - #48843

Open
anjaliratnam-msft wants to merge 2 commits into
Azure:feature/storage/sessionfrom
anjaliratnam-msft:session-provider-sync
Open

Session provider sync implementation#48843
anjaliratnam-msft wants to merge 2 commits into
Azure:feature/storage/sessionfrom
anjaliratnam-msft:session-provider-sync

Conversation

@anjaliratnam-msft

Copy link
Copy Markdown
Member

Summary
This PR introduces SessionProvider building off the previous #47264. Customers can optionally supply one via session_options.session_provider and reuse it across clients to share the cache. If it's not supplied, one is created and scoped to the client, so existing behavior is unchanged.

Copilot AI balanced review requested due to automatic review settings September 2, 2026 00:19
@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label Sep 2, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@anjaliratnam-msft
anjaliratnam-msft changed the base branch from main to feature/storage/session September 2, 2026 00:20

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

The tests fail to parse, and session handling has unresolved URL, audience, typing, and cache issues.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds synchronous, shareable session-provider support atop the existing blob GET session authentication.

Changes:

  • Adds session caching, signing, bearer fallback, and provider sharing.
  • Exposes session configuration through synchronous clients.
  • Adds session tests, sanitizers, and release notes.
File summaries
File Description
CHANGELOG.md Documents session authentication.
azure/storage/blob/__init__.py Exports session providers.
_blob_service_client.py Documents session options.
_blob_service_client.pyi Adds session parameters.
_container_client.py Documents session options.
_container_client.pyi Adds session parameters.
_shared/base_client.py Integrates session policy/provider.
_shared/models.py Adds session error codes.
_shared/policies.py Implements signing and fallback.
_shared/session.py Implements providers and cache.
tests/conftest.py Sanitizes session credentials.
tests/test_container.py Tests session behavior.
tests/test_helpers.py Adds authentication test helpers.
Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 10
  • Review effort level: Balanced

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

Comment thread sdk/storage/azure-storage-blob/tests/test_container.py Outdated
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_shared/session.py Outdated
Comment on lines +145 to +146
with self._locks_guard:
return self._locks.setdefault(container_url, Lock())
assert session2 == _parse_session_token(capture_auth_header["c2_download2"])

policy = _find_session_policy(service._pipeline)
cached = policy._cache._entry[container1_name]
Comment on lines +271 to +272
"SessionProvider",
"ContainerSessionProvider",
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.pyi Outdated
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.pyi Outdated
StorageSensitiveHeaderCleanupPolicy(**kwargs),
]
use_session = bool(kwargs.pop("use_session", False))
session_provider = kwargs.pop("session_provider", None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When you are working on tests, this is good. We want a test case for a user providing a session provider.

Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py Outdated
StorageSensitiveHeaderCleanupPolicy(**kwargs),
]
use_session = bool(kwargs.pop("use_session", False))
session_provider = kwargs.pop("session_provider", None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When you are working on tests, this is good. We want a test case for a user providing a session provider.

Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py Outdated
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_shared/session.py Outdated
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_shared/session.py Outdated
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_shared/session.py Outdated
Comment thread sdk/storage/azure-storage-blob/azure/storage/blob/_shared/session.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants