Description
We support two ways to create a CosmosClient
:
CosmosClient::new(endpoint: &str, credential: Arc<dyn TokenCredential>, options: Option<CosmosClientOptions>)
which uses Entra IDCosmosClient::with_key(endpoint: &str, key: azure_core::Secret, options: Option<CosmosClientOptions>)
which uses key-based auth (Requireskey_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.