-
-
Save johndowns/6fe30a1c8cafcde1999f53c4468c90e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
var cosmosDBClient = new DocumentClient( | |
new Uri(ConfigurationManager.AppSettings["CosmosDBAccountEndpoint"]), | |
ConfigurationManager.AppSettings["CosmosDBAccountKey"]); | |
await cosmosDBClient.GetDatabaseAccountAsync(); | |
} | |
catch (DocumentClientException ex) when (ex.StatusCode == HttpStatusCode.Unauthorized) | |
{ | |
return req.CreateResponse(HttpStatusCode.InternalServerError, "The Cosmos DB account key is not valid."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment