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.
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 stringsAlso based on this MICRSOFT DOCUMENT:
For more information please refer this SO THREAD.