Why is the queue domain on my azure storage accoun

2019-04-28 05:52发布

问题:

I have successfully create a storage account on Azure with the following settings:

  • Deployment: Resource manager
  • Type: General Purpose (Standard)
  • Replication: ZRS

On the Azure portal I can see a "Blobs" service and if I click on it, I can create blob containers under the blob domain: https://[account_name].blob.core.windows.net/

So far so good.

When I try to create a queue using the Azure SDK in a C# app I get the error that it can't find the domain for [account_name].queue.core.windows.net .

I've been following the Microsoft tutorials for creating a storage account and getting a simple queue working and I can't see any other steps the create this "queue" domain. On the Azure portal itself, I can't find any other options to create a Queue or Queue service.

The code I'm using for reference:

var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ToString());

var blobClient = storageAccount.CreateCloudBlobClient();
var blobContainer = blobClient.GetContainerReference("export");
blobContainer.CreateIfNotExists();

var queueClient = storageAccount.CreateCloudQueueClient();
var exportQueue = queueClient.GetQueueReference("export-requests");
exportQueue.CreateIfNotExists();

The call to create the blob container succeeds and I can see the new container in the Azure Portal. The call to create the queue fails with the following exception:

An exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in Microsoft.WindowsAzure.Storage.dll but was not handled in user code

Additional information: The remote name could not be resolved: '[account_name].queue.core.windows.net'

回答1:

The reason you're getting this error is because ZRS storage accounts only support Blob Storage (and that too Block Blobs only). From this blog post: https://blogs.msdn.microsoft.com/windowsazurestorage/2014/08/01/introducing-zone-redundant-storage/ (see section Using a ZRS account)

Since ZRS accounts do not support page blob, file, table or queue, any attempt to create or manipulate those objects on a ZRS storage account will fail.

If you want to use queues, you need to choose another redundancy level. At this time following types of storage account redundancy levels support queues - LRS, GRS, and RAGRS. Currently it is not possible to change a ZRS account into LRS/GRS/RAGRS account. Thus you would need to create a new storage account.