You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CosmosDB Components should allow for CosmosClientOptions to be configured via IConfiguration #667
area-integrationsIssues pertaining to Aspire Integrations packagesazureIssues associated specifically with scenarios tied to using Azureazure-cosmosdbIssues related to Azure CosmosDB
With #359, we added CosmosDB Components. ComosDB follows the same pattern as other Azure clients - it has XXXClient and XXXClientOptions objects.
The other Azure components allow for the XXXClientOptions object to be bound to IConfiguration, so users can tweak their settings without rebuilding/redeploying the app.
We should enable the same behavior in the CosmosDB components.
The benefit would be using the DI container to resolve RequestHandler instances that may require container services to instantiate as part of calling clientOptions.CustomHanndlers.Add(...);
Might I suggest adding an overload/support for passing IServiceProvider when creating CosmosClientOptions as well?
Yes, that is a good idea. Other Azure integrations get this for free because they integrate with Microsoft.Extensions.Azure, but CosmosDB's client library doesn't yet. So we would need an explicit action that takes an IServiceProvider.
Implemented as part of the Aspire.Microsoft.Azure.Cosmos component. The component includes a MicrosoftAzureCosmosSettings class that binds to configuration under the Aspire:Microsoft:Azure:Cosmos key (via [ConfigurationSchema] attribute), allowing CosmosClientOptions-equivalent settings to be configured through appsettings.json or environment variables. The AddAzureCosmosClient APIs also accept a configureClientOptions: Action<CosmosClientOptions> parameter for in-code customization.
Reopening after reviewing the recent bulk closure. The close comment appears to cite work that does not fully address this issue, so this should remain open for normal triage.
area-integrationsIssues pertaining to Aspire Integrations packagesazureIssues associated specifically with scenarios tied to using Azureazure-cosmosdbIssues related to Azure CosmosDB
Activity
davidfowl commentedon Jan 27, 2024
Do we still want to do this?
eerhardt commentedon Jan 29, 2024
I think so. It should be consistent with the other Azure components.
eerhardt commentedon Feb 26, 2024
Kevin Pilch (@Pilchie) - is this something your team plans on implementing?
eerhardt commentedon Apr 18, 2024
Debdatta Kunda (@kundadebdatta) - can I assign this issue to you?
6 remaining items
AdamDotNet commentedon May 21, 2025
Eric Erhardt (@eerhardt)
Might I suggest adding an overload/support for passing IServiceProvider when creating CosmosClientOptions as well?
From
To
The benefit would be using the DI container to resolve
RequestHandlerinstances that may require container services to instantiate as part of callingclientOptions.CustomHanndlers.Add(...);eerhardt commentedon May 23, 2025
Yes, that is a good idea. Other Azure integrations get this for free because they integrate with Microsoft.Extensions.Azure, but CosmosDB's client library doesn't yet. So we would need an explicit action that takes an
IServiceProvider.msivers commentedon Jun 13, 2025
Eric Erhardt (@eerhardt) / David Fowler (@davidfowl) / Debdatta Kunda (@kundadebdatta) is this going to be worked on?... Feels like an important capability that is missing?
davidfowl commentedon Jun 13, 2025
We’re not proactively prioritizing integration specific features, but feel free to submit a PR!
maddymontaquila commentedon May 14, 2026
Implemented as part of the
Aspire.Microsoft.Azure.Cosmoscomponent. The component includes aMicrosoftAzureCosmosSettingsclass that binds to configuration under theAspire:Microsoft:Azure:Cosmoskey (via[ConfigurationSchema]attribute), allowingCosmosClientOptions-equivalent settings to be configured throughappsettings.jsonor environment variables. TheAddAzureCosmosClientAPIs also accept aconfigureClientOptions: Action<CosmosClientOptions>parameter for in-code customization.davidfowl commentedon May 14, 2026
Reopening after reviewing the recent bulk closure. The close comment appears to cite work that does not fully address this issue, so this should remain open for normal triage.
AdamDotNet commentedon Aug 13, 2026
David Fowler (@davidfowl) Eric Erhardt (@eerhardt) created a PR for this!
Add IServiceProvider support to Cosmos DB extensions (#19349)