Skip to content

Use migration SAS credentials in Storage clients - #1448

Open
sophiatev wants to merge 1 commit into
mainfrom
stevosyan/storage-migration-storage-clients
Open

sophiatev wants to merge 1 commit into
mainfrom
stevosyan/storage-migration-storage-clients

Conversation

@sophiatev

Copy link
Copy Markdown
Contributor

Storage requests during migration need renewable SAS credentials so cached clients stop sending when migration is ending. Wire the existing migration credential manager and request policies into the queue, table, and blob wrappers. Clients share initialization, recover from failed initialization, and use refreshed credentials without being recreated. Migration data requests use the 30-second server timeout, disable generic SDK retries, and retain the single authentication retry.

Resource creation and container management retain the original credentials with an explicit access check. Deleting an entire task-hub queue, table, or container is rejected during migration. SAS policies use separate client options so they do not affect other clients sharing the provider.

This is extracted from stevosyan/storage-migration, following #1447. Service startup will opt into these clients in a later PR; existing service construction does not enable migration. Experimental timing telemetry is excluded.

Tests extend MigrationSasManagerTests using real SDK clients with local simulated responses. The ten new cases cover cached-client renewal and drain rejection, shared-key and identity credentials, initialization retries, management access, ordinary-client isolation, and authentication retries for all three services. The existing large-message scenario helper now checks the blob through the SDK directly after the internal wrapper constructor change.

Validation: 80 tests passed on .NET 8 and 80 on .NET Framework 4.8 (160 total), covering the credential manager, client integration, migration control, and storage client providers. No Azure account or emulator is needed for these tests.

Copilot AI balanced review requested due to automatic review settings December 2, 2026 01:19

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

An initialization/restart race can keep credential renewal running after stop completes, while migration blob options discard configured encryption settings.

2 open issues
What changed in this PR

Wires renewable migration SAS credentials into Azure Storage wrappers, building on #1447’s request policies. Existing service construction remains unchanged; migration activation comes later.

Changes:

  • Adds cached SAS clients with shared initialization, renewal, timeout, and retry policies.
  • Preserves original credentials for management operations and blocks whole-resource deletion during migration.
  • Adds simulated SDK integration tests and updates the large-message blob check.
File Description
test/​DurableTask.AzureStorage.Tests/​MigrationSasManagerTests.cs Tests renewal, drain, initialization recovery, management access, and retries.
test/​DurableTask.AzureStorage.Tests/​AzureStorageScenarioTests.cs Checks blob existence directly through the SDK.
src/​DurableTask.AzureStorage/​Storage/​Table.cs Uses cached SAS clients for table data operations.
src/​DurableTask.AzureStorage/​Storage/​Queue.cs Uses cached SAS clients and guards queue management.
src/​DurableTask.AzureStorage/​Storage/​BlobContainer.cs Separates SAS data access from guarded container management.
src/​DurableTask.AzureStorage/​Storage/​Blob.cs Lazily obtains migration-aware blob clients.
src/​DurableTask.AzureStorage/​Storage/​AzureStorageClient.cs Coordinates initialization and constructs isolated SAS clients and policies.

Review effort: Balanced


public Task StopMigrationTokenRefreshAsync()
{
return this.migration?.StopRefreshing() ?? Task.CompletedTask;
Comment on lines +254 to +255
Audience = blobManagementOptions!.Audience,
GeoRedundantSecondaryUri = blobManagementOptions.GeoRedundantSecondaryUri,
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