Skip to content

[Enhancement]: CosmosDb: Add getters for AccountEndpoint and AccountKey #1704

Closed

Description

@srollinet

Problem

In my test setup, I need to get the ComsmosDb container's AccountEndpoint and AccountKey properties to configure my services.

CosmosDbContainer exposes the connection string that contains these properties. But it would be more convenient to have those properties directly exposed rather than having to parse the connection string

public string GetConnectionString()
{
var properties = new Dictionary<string, string>();
properties.Add("AccountEndpoint", new UriBuilder(Uri.UriSchemeHttp, Hostname, GetMappedPublicPort(CosmosDbBuilder.CosmosDbPort)).ToString());
properties.Add("AccountKey", CosmosDbBuilder.DefaultAccountKey);
return string.Join(";", properties.Select(property => string.Join("=", property.Key, property.Value)));
}

Solution

Add getters or get methods to return both AccountEndpoint and AccountKey and rewrite GetConnectionString to use those getters.

Benefit

Getting the properties in a more convenient way, while keeping the CosmosDbContainer class easy to read and maintain.

Alternatives

Get them by parsing the connection string as done today.

Would you like to help contributing this enhancement?

Yes

Activity

  1. added
    enhancement
    on Jun 15, 2026
  2. coderabbitai commented on Jun 15, 2026

    @coderabbitai
    🔗 Related PRs

    #1622 - feat(ServiceBus): Add method to get HTTP connection string [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. HofmeisterAn commented on Jun 16, 2026

    @HofmeisterAn
    Collaborator

    👍 I think we can align it with the Azurite implementation (AccountKey is already available).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions