Viveka
Viveka

Reputation: 360

Azure.Storage.Blobs: No valid combination of account information found

I have created blob triggered azure function and while connecting it to azure I am getting error as "No valid combination of account information found". Here is my code sample

CloudStorageAccount StorageConn;  
CloudBlobClient BlobClient; 
StorageConn = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("MyConn")); 
BlobClient = StorageConn.CreateCloudBlobClient(); 
BlobServiceClient blobServiceClient = new BlobServiceClient(StorageConn.ToString());//At this line I am getting the error;

and in local.settings.json:

{
    "IsEncrypted": false,
    "Values": {     
       "MyConn": "DefaultEndpointsProtocol=https;AccountName=***;AccountKey=***",
     } 
}

Error Screen

Upvotes: 0

Views: 4297

Answers (2)

rickvdbosch
rickvdbosch

Reputation: 15561

Your connection string is not complete: it misses the EndPointSuffix. Although documentation states this is only needed 'for a storage service in regions or instances with different endpoint suffixes', it seems this is necessary for storage accounts in all regions now.

To create a connection string for a storage service in regions or instances with different endpoint suffixes, such as for Azure China 21Vianet or Azure Government, use the following connection string format.

To make sure you have the correct connection string, you can

  1. Go to the Azure portal
  2. Navigate to the storage account
  3. Go to Security + Networking -> Access Keys
  4. Click 'Show keys' on the top left corner
  5. Copy either of the Connection Strings

A complete connection string for the general Azure cloud looks something like this:

DefaultEndpointsProtocol=https;AccountName=***;AccountKey=**;EndpointSuffix=core.windows.net

EDIT:
Please also double check there are no whitespace characters in the connection string. That might break things for you.

Upvotes: 1

vivek jain
vivek jain

Reputation: 301

Can you try with below connection string

{
    "MyConn": "DefaultEndpointsProtocol=https;AccountName=***;AccountKey=***;EndpointSuffix=core.windows.net"
}

Upvotes: 0

Related Questions