Link: Azure documentation
Connection string for Azure storage account:
DefaultEndpointsProtocol=[http|https];AccountName=myAccountName;AccountKey=myAccountKey
example:
DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey=<account-key>
Connection string to the storage emulator:
config.xml
<appSettings> <add key="StorageConnectionString" value="UseDevelopmentStorage=true" /> </appSettings> DefaultEndpointsProtocol=http;AccountName=testacc1; AccountKey=1gy3lpE7Du1j5ljKiupgKzywSw2isjsdfdsfsdfsdsgfsgfdgfdgfd/YThisv/OVVLfIOv9kQ==; BlobEndpoint=http://127.0.0.1:8440/testacc1; TableEndpoint=http://127.0.0.1:8440/testacc1; QueueEndpoint=http://127.0.0.1:8440/testacc1;
Example:
<connectionStrings> <add name="AzureStorageAccount" connectionString="DefaultEndpointsProtocol=https;AccountName=testdata;AccountKey=1gy3lpE7Du1j5ljKiupgKzywSw2isjsdfdsfsdfsdsgfsgfdgfdgfd/YThisv/OVVLfIOv9kQ==;"/> </connectionStrings>
But sometimes it will not work and will be due to an error
An unhandled exception of type 'System.FormatException' occurred in Microsoft.WindowsAzure.Storage.dll Additional information: No valid combination of account information found.
then please try with the code below: checked and works 100%
var accountName = "test2rdsfdg462"; var keyValue = "1gy3lpE7Du1j5ljKiupgKzywSfsdfdsfsdfsdfsdfsdfsdqGxd7/YThisv/OVVLfIOv9kQ=="; var useHttps = true; var connValid = true; var storageCredentials = new StorageCredentials(accountName, keyValue); var storageAccount = new CloudStorageAccount(storageCredentials, useHttps); var conString = storageAccount.ToString(connValid); CloudStorageAccount sa = CloudStorageAccount.Parse(connString);
source share