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

Time:10-27

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

CodePudding user response:

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

CodePudding user response:

Can you try with below connection string

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