Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created June 24, 2020 21:16
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 manoj-choudhari-git/3de49ae8c76d8f707d35c890cf38e49d to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/3de49ae8c76d8f707d35c890cf38e49d to your computer and use it in GitHub Desktop.
TLS 1.2 protocol for connecting with Azure Storage
static void StorageAccountUsingTLS12()
{
// Enable TLS 1.2 before connecting to Azure Storage
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
// Connect to Azure Storage
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName={yourstorageaccount};AccountKey={yourstorageaccountkey};EndpointSuffix=core.windows.net");
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("foo");
container.CreateIfNotExists();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment