CosmosClientBuilder.WithCustomAccountEndpoints(IEnumerable<Uri>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the custom endpoints to use for account initialization for geo-replicated database accounts in the Azure Cosmos DB service. During the CosmosClient initialization the account information, including the available regions, is obtained from the Endpoint. Should the global endpoint become inaccessible, the CosmosClient will attempt to obtain the account information issuing requests to the custom endpoints provided in the customAccountEndpoints list.
public Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithCustomAccountEndpoints (System.Collections.Generic.IEnumerable<Uri> customAccountEndpoints);
member this.WithCustomAccountEndpoints : seq<Uri> -> Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder
Public Function WithCustomAccountEndpoints (customAccountEndpoints As IEnumerable(Of Uri)) As CosmosClientBuilder
Parameters
- customAccountEndpoints
- IEnumerable<Uri>
An instance of IEnumerable<T> of Uri containing the custom private endpoints for the cosmos db account.
Returns
The current CosmosClientBuilder.
Examples
The example below creates a new instance of CosmosClientBuilder with the regional endpoints.
CosmosClientBuilder cosmosClientBuilder = new CosmosClientBuilder(
accountEndpoint: "https://testcosmos.documents.azure.com:443/",
authKeyOrResourceToken: "SuperSecretKey")
.WithCustomAccountEndpoints(new HashSet<Uri>()
{
new Uri("https://region-1.documents-test.windows-int.net:443/"),
new Uri("https://region-2.documents-test.windows-int.net:443/")
});
CosmosClient client = cosmosClientBuilder.Build();
Remarks
This function is optional and is recommended for implementation when a customer has configured one or more endpoints with a custom DNS hostname (instead of accountname-region.documents.azure.com) etc. for their Cosmos DB account.