Repository navigation
feat(eventhubs): restore connection string authentication - #7293
Sagar Patel (sagar0207) wants to merge 4 commits into
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 7 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
ea1825b to
5bb10d2
Compare
|
@microsoft-github-policy-service agree company="Microsoft" |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 7 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Restores the previously-available connection-string authentication entry points for Azure Event Hubs ProducerClient and ConsumerClient, bringing the C++ SDK back in line with earlier betas and enabling local/emulator scenarios that require SAS/connection strings.
Changes:
- Reintroduced public connection-string constructors (with uAMQP support; Rust AMQP throws an unsupported-backend error).
- Restored emulator-specific behavior (non-TLS AMQP, defaulting to port 5672, rejecting 5671).
- Added focused unit tests and restored/updated connection-string samples and documentation.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/eventhubs/azure-messaging-eventhubs/test/ut/connection_string_test.cpp | Adds offline constructor behavior tests plus an opt-in live round-trip test for connection-string auth. |
| sdk/eventhubs/azure-messaging-eventhubs/test/ut/CMakeLists.txt | Includes the new connection-string unit test source in the test target. |
| sdk/eventhubs/azure-messaging-eventhubs/src/producer_client.cpp | Implements the connection-string constructor and emulator port/scheme selection for ProducerClient. |
| sdk/eventhubs/azure-messaging-eventhubs/src/consumer_client.cpp | Implements the connection-string constructor and emulator port/scheme selection for ConsumerClient. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/README.md | Updates sample environment variables and sample list to reflect restored connection-string samples. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/produce-events/produce_events.cpp | Restores a connection-string-based “produce events” sample. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/produce-events/CMakeLists.txt | Adds the restored sample and disables automatic run for connection-string sample execution. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/consume-events/consume_events.cpp | Restores a connection-string-based “consume events” sample. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/consume-events/CMakeLists.txt | Adds the restored sample and disables automatic run for connection-string sample execution. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/basic-operations/create_producer.cpp | Restores a connection-string-based “create producer” sample. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/basic-operations/create_consumer.cpp | Restores a connection-string-based “create consumer” sample. |
| sdk/eventhubs/azure-messaging-eventhubs/samples/basic-operations/CMakeLists.txt | Adds restored basic-operation samples and disables automatic run for connection-string samples. |
| sdk/eventhubs/azure-messaging-eventhubs/README.md | Updates README examples and guidance for Entra ID and connection-string auth, matching the restored API surface. |
| sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/producer_client.hpp | Restores the public connection-string constructor signature and Doxygen contract for ProducerClient. |
| sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/consumer_client.hpp | Restores the public connection-string constructor signature and Doxygen contract for ConsumerClient. |
| sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md | Records the restoration as a new feature under the next unreleased version. |
|
I filed #7295 to track the Rust AMQP side, so the unsupported-backend guard in this PR has a follow-up that removes it. The gap is narrower than the note in this PR suggests. Three things block it, and the surrounding machinery already works. The parts that already work: The one open decision in #7295 is where the HMAC-SHA256 lives. The root |
|
Sagar Patel (@sagar0207) the Rust AMQP side is now ready for review at sagar0207#1, which targets this branch. Merging it removes the unsupported-backend guard here, and it turns on ten of the connection-string tests that currently run only under uAMQP. |
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
| // cspell: words amqpclaimsbasedsecurity | ||
| // cspell: words amqpclaimsbasedsecurity sastoken servicebus |
There was a problem hiding this comment.
These changes should go into the AMQP library in the azure-sdk-for-rust SDK and we should get rid of this client.
Originally the plan was for the C++ code to depend on the Rust azure_core_amqp package directly via cargo but I ran out of time to fix that.
This seems like an incredible opportunity to break this private fork of the azure_core_amqp package and use just the primary package.
The primary package already has a cplusplus feature intended for this use.
There was a problem hiding this comment.
Larry Osterman (@LarryOsterman) One of the concerns that our managers had was that given the timeframe of the changes (we want to get all of the producer and auth changes out in the next month for Billing), we didn't want to rock the boat with depending on the rust implementation.
I'll check with the team. Maybe we should break like you said.
cc Sagar Patel (@sagar0207) Eric Lam (MSFT) (@hmlam) SJ (@sjkwak)
Copilot-Session: f65b70a0-d52e-48a7-84f7-826ff4b091c5
Copilot-Session: f65b70a0-d52e-48a7-84f7-826ff4b091c5
Copilot-Session: f65b70a0-d52e-48a7-84f7-826ff4b091c5
21333c7 to
78e82ad
Compare
Summary
Restore connection-string authentication for the Event Hubs
ProducerClientandConsumerClient.The constructors were available through
1.0.0-beta.10and were removed in1.0.0-beta.11during the Rust AMQP merge. The connection-string parser and SAS credential remained, but the Rust backend's token generation and CBS SAS-token handling were incomplete.Fixes #7250 and #7295.
Azure DevOps work item: 39045651
Related earlier draft: #7251.
Changes
Restored the previous public constructor signatures:
Reused
ServiceBusSasConnectionStringCredentialand the existing uAMQP CBS SAS-token path.Added SAS support to the default Rust AMQP backend:
servicebus.windows.net:sastokenthrough the Rust CBS path.Restored
EntityPathbehavior:EntityPath.std::invalid_argument.EntityPath.Restored Event Hubs emulator support:
Added focused offline tests, a shared fixed-vector token test, and an opt-in live round-trip test.
Restored and updated four connection-string samples:
create_producer.cppcreate_consumer.cppproduce_events.cppconsume_events.cppKept those samples in compile coverage but excluded them from automatic live sample execution because the standard live resources do not expose a connection string.
Updated the package README with:
EntityPath.Updated the samples README and changelog.
Validation
The branch was rebased onto current
mainat5270d5ae7.uAMQP
Event Hubs emulator
The focused round-trip test passed on both uAMQP and Rust AMQP against the Docker Event Hubs emulator using the official connection-string shape without an explicit port.
The test opened the receiver, sent one event, received it, and compared the event body.
Azure Event Hubs
The focused round-trip test passed on both uAMQP and Rust AMQP against:
cpp-connscale-nseh-connscale-testing$DefaultThe connection string was held only in process memory and removed after the test.
Rust AMQP
Scope
This PR does not:
BlobCheckpointStoreconstructor.Security