private void DownloadFromBlobUri(Uri sourceUri, string localFileInfo) { BlobUri blobUri; string storagekey=""; if (!BlobUri.TryParseUri(sourceUri, out blobUri)) { throw new ArgumentOutOfRangeException("Source", sourceUri.ToString()); } var storageClient = AzureSession.ClientFactory.CreateClient<StorageManagementClient>( DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); var storageService = storageClient.StorageAccounts.GetProperties(this.ResourceGroupName, blobUri.StorageAccountName); if (storageService != null) { var storageKeys = storageClient.StorageAccounts.ListKeys(this.ResourceGroupName, storageService.StorageAccount.Name); storagekey = storageKeys.StorageAccountKeys.Key1; } StorageCredentials storagecred = new StorageCredentials(blobUri.StorageAccountName, storagekey); var blob = new CloudBlob(sourceUri, storagecred); blob.DownloadToFile(localFileInfo, FileMode.Create); }