Skip to content

FIX: Use DefaultAzureCredential directly for blob storage auth#1615

Open
adrian-gavrila wants to merge 4 commits intomicrosoft:mainfrom
adrian-gavrila:adrian-gavrila/blob_storage_access_fix
Open

FIX: Use DefaultAzureCredential directly for blob storage auth#1615
adrian-gavrila wants to merge 4 commits intomicrosoft:mainfrom
adrian-gavrila:adrian-gavrila/blob_storage_access_fix

Conversation

@adrian-gavrila
Copy link
Copy Markdown
Contributor

Description

Replaces the user delegation SAS token flow in AzureBlobStorageIO with direct DefaultAzureCredential authentication. This
removes the requirement for the Storage Blob Delegator RBAC role — Storage Blob Data Contributor is now sufficient.

The explicit SAS token path is preserved. AzureStorageAuth is still used by AzureBlobStorageTarget and is unaffected.

Tests and Documentation

  • All 25 unit tests in test_storage_io.py pass (updated existing test, added 2 new tests)
  • Manually verified image upload to airtstorageaccountprod with only Storage Blob Data Contributor
  • No doc changes needed — internal auth change, no API surface change

Adrian Gavrila and others added 4 commits April 13, 2026 17:37
Replace the user delegation SAS token flow with direct DefaultAzureCredential
authentication. This removes the need for the Storage Blob Delegator role -
Storage Blob Data Contributor is now sufficient for blob operations.

The SAS token path is preserved for callers who explicitly provide one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Store DefaultAzureCredential on self and close it via _close_client_async helper
- Replace all inline client close/reset blocks with _close_client_async calls
- Update auth error message to reflect direct credential flow
- Fix existing test that patched removed AzureStorageAuth.get_sas_token
- Add new test for DefaultAzureCredential path when no SAS token provided

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
if not self._sas_token:
logger.info("SAS token not provided. Creating a delegation SAS token using Entra ID authentication.")
sas_token = await AzureStorageAuth.get_sas_token(self._container_url)
if self._sas_token:
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.

curious: how come we don't need to make a similar change to AzureBlobStorageTarget?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants