Skip to content

Instantly share code, notes, and snippets.

@johndowns
Created September 17, 2018 09:53
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 johndowns/1acfa2bb8cdd24e6f7e38251bc766631 to your computer and use it in GitHub Desktop.
Save johndowns/1acfa2bb8cdd24e6f7e38251bc766631 to your computer and use it in GitHub Desktop.
try
{
var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageAccountConnectionString"]);
var storageClient = storageAccount.CreateCloudBlobClient();
var storageContainer = storageClient.GetContainerReference("mycontainer");
await storageContainer.ExistsAsync();
}
catch (StorageException ex) when (ex.RequestInformation.HttpStatusCode == 403)
{
return req.CreateResponse(HttpStatusCode.InternalServerError, "The storage account key is not valid.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment