Skip to content

fix(azure_blob): make AccountName optional when BlobEndpoint is provided#24663

Open
yoelk wants to merge 1 commit intovectordotdev:masterfrom
yoelk:fix/azure-blob-account-name-optional
Open

fix(azure_blob): make AccountName optional when BlobEndpoint is provided#24663
yoelk wants to merge 1 commit intovectordotdev:masterfrom
yoelk:fix/azure-blob-account-name-optional

Conversation

@yoelk
Copy link
Copy Markdown

@yoelk yoelk commented Feb 16, 2026

Summary

This PR fixes a regression introduced in v0.52.0 where AccountName became required in Azure Blob Storage connection strings, even when BlobEndpoint was provided. This broke existing configurations that relied on SAS tokens with blob endpoints.

The fix:

  • When BlobEndpoint is provided but AccountName is missing, the account name is now automatically extracted from the endpoint URL
  • Example: https://mystorageaccount.blob.core.windows.net/ → account name is mystorageaccount
  • This restores v0.45.0 behavior and matches the intent described in the existing code comments

Changes made:

  • Modified build_client() in src/sinks/azure_common/config.rs to make AccountName optional when BlobEndpoint is present
  • Added extract_account_name_from_endpoint() helper function to parse account names from blob endpoint URLs
  • Added comprehensive unit tests covering all connection string scenarios

Vector configuration

Connection string that was broken (now works):

[sinks.azure_blob]
type = "azure_blob"
connection_string = "BlobEndpoint=https://mystorageaccount.blob.core.windows.net/;SharedAccessSignature=sv=2021-01-01&sig=..."
container_name = "logs"

Connection string that still works (unchanged):

[sinks.azure_blob]
type = "azure_blob"
connection_string = "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=...;EndpointSuffix=core.windows.net"
container_name = "logs"

How did you test this PR?

Added unit tests in src/sinks/azure_common/config.rs:

  • test_extract_account_name_from_endpoint - Tests URL parsing with various endpoint formats
  • test_build_client_with_account_name_in_connection_string - Tests traditional connection strings with explicit AccountName
  • test_build_client_with_blob_endpoint_and_account_name - Tests when both AccountName and BlobEndpoint are provided
  • test_build_client_with_blob_endpoint_without_account_name - Tests the regression fix - BlobEndpoint without AccountName
  • test_build_client_without_account_name_or_blob_endpoint - Tests proper error handling

Verified compilation with cargo check -p vector --lib

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

  • Fixes: ENG-166496

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details here.

This fixes a regression from v0.45.0 where AccountName was required
even when BlobEndpoint was provided in the connection string.

When BlobEndpoint is present but AccountName is missing, the account
name is now extracted from the endpoint URL (e.g., from
https://mystorageaccount.blob.core.windows.net/).

This matches the behavior described in the code comments and restores
backward compatibility with v0.45.0.

Fixes: ENG-166496
@yoelk yoelk requested a review from a team as a code owner February 16, 2026 20:50
@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Feb 16, 2026
@mortenmj
Copy link
Copy Markdown

@vectordotdev/vector could we get this PR merged? We've been unable to keep up with recent versions due to this issue.

@mortenmj
Copy link
Copy Markdown

@thomasqueirozb are you able to help here?

@jlaundry jlaundry mentioned this pull request Apr 8, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: sinks Anything related to the Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants