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

Add option to enable connection's LimitToEndpoint property #101

Closed
cmendible opened this issue May 23, 2023 · 0 comments · Fixed by #102
Closed

Add option to enable connection's LimitToEndpoint property #101

cmendible opened this issue May 23, 2023 · 0 comments · Fixed by #102

Comments

@cmendible
Copy link
Contributor

With the change to the new Cosmos DB SDK we have a similar issue to #61.

it´s not possible to connect with a Cosmos DB database that is protected via private endpoint and also behind an Azure Application Gateway because the default connection policy disables LimitToEndpoint by default: https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.limittoendpoint?view=azure-dotnet#microsoft-azure-cosmos-cosmosclientoptions-limittoendpoint

CosmosDBExplorer should provide a way to enable LimitToEndpoint , using code similar to the following:

        private CosmosClient CreateClient(CosmosConnection connection)
        {
            var options = new CosmosClientOptions
            {
                ConnectionMode = connection.ConnectionType == ConnectionType.Gateway ? ConnectionMode.Gateway : ConnectionMode.Direct,
                EnableTcpConnectionEndpointRediscovery = connection.EnableEndpointDiscovery,
                LimitToEndpoint = connection.LimitToEndpoint
            };

            return new CosmosClient(accountEndpoint: connection.DatabaseUri?.ToString(), authKeyOrResourceToken: connection.AuthenticationKey, options);
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant