Skip to content

Instantly share code, notes, and snippets.

@ealsur
Created February 15, 2019 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ealsur/c2cb79d6159830cdad47231d5ef36ca0 to your computer and use it in GitHub Desktop.
Save ealsur/c2cb79d6159830cdad47231d5ef36ca0 to your computer and use it in GitHub Desktop.
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