Azure Storage (classic) vs Azure Storage (V2) code not working for V2 storage

114 views Asked by At

I have a worker role running and checking to see if data exists in a storage hosted on Azure. My code works when I use the connection string for a classic type of storage, but when I connect to my V2 Azure storage, it throws this exception.

"The remote server returned an error: (400) Bad Request."

while (true) 
{ 
    try 
    { 
      if (queue.Exists()) // The exception is throw here. 
      {
         try
         {
            CloudQueueMessage msg = await queue.GetMessageAsync();
            if (msg != null)
            {
              //data manipulation code...
            }
         }
   
      }
    }
}

I'm expecting to be able to use a V2 storage instead of classic as classic is now depreciated on Azure.

1

There are 1 answers

2
AjayKumarGhose On

Below are the few workaround may solved the above issue,

The authorization information required for your application to access data in an Azure Storage account at runtime using Shared Key authorzation is contained in a connection string. As illustrated below, you can configure connection strings.

  • Establish a connection with the Azurite storage emulator.

  • In Azure, you can access a storage account.

  • Access specified resources in Azure via a shared access signature (SAS).

Please make sure to provide the correct connection string of storage account which you want to get/read the data.

For more information,please refer to this MS DOC|Configure Azure Storage connection strings

Also based on this MICRSOFT DOCUMENT:


If you attempt to create a container or blob with a name that violates naming rules, the request will fail with status code 400 (Bad Request).


For more information please refer this SO THREAD.