Created
June 24, 2020 21:16
-
-
Save manoj-choudhari-git/3de49ae8c76d8f707d35c890cf38e49d to your computer and use it in GitHub Desktop.
TLS 1.2 protocol for connecting with Azure Storage
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
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