Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cosmos] Support creating a client from a connection string #1939

Open
analogrelay opened this issue Dec 2, 2024 · 0 comments
Open

[Cosmos] Support creating a client from a connection string #1939

analogrelay opened this issue Dec 2, 2024 · 0 comments
Assignees
Labels
Cosmos The azure_cosmos crate

Comments

@analogrelay
Copy link
Member

We support two ways to create a CosmosClient:

  • CosmosClient::new(endpoint: &str, credential: Arc<dyn TokenCredential>, options: Option<CosmosClientOptions>) which uses Entra ID
  • CosmosClient::with_key(endpoint: &str, key: azure_core::Secret, options: Option<CosmosClientOptions>) which uses key-based auth (Requires key_auth feature)

We don't support specifying a connection string, since with_key accepts all the values a connection string would normally provide. However, often users specify connection strings in config, and our other clients can be constructed from a connection string. So, we should add another method:

  • CosmosClient::with_connection_string(connection_string: azure_core::Secret, options: Option<CosmosClientOptions>)

This method would require the key_auth feature, since it's for specifying a key. Also, the connection string should be a Secret because it contains the key.

@analogrelay analogrelay added the Cosmos The azure_cosmos crate label Dec 2, 2024
@analogrelay analogrelay self-assigned this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cosmos The azure_cosmos crate
Projects
None yet
Development

No branches or pull requests

1 participant