Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Azure Cosmos DB + Functions Cookbook - monitoring - helper
private class CosmosDBConnectionString
{
public CosmosDBConnectionString(string connectionString)
{
// Use this generic builder to parse the connection string
DbConnectionStringBuilder builder = new DbConnectionStringBuilder
{
ConnectionString = connectionString
};
if (builder.TryGetValue("AccountKey", out object key))
{
AuthKey = key.ToString();
}
if (builder.TryGetValue("AccountEndpoint", out object uri))
{
ServiceEndpoint = new Uri(uri.ToString());
}
}
public Uri ServiceEndpoint { get; set; }
public string AuthKey { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.