locked
Fail to to add message to a queue, returned bad request RRS feed

  • Question

  • Using the SAS/URL for a specific access policy(which has Add permission and also expires in 10 years from now), when adding the message to the queue, it returns 400 (bad request). Any ideas what's going on? I was trying to figure out whether or not is a version problem, etc... 
    Wednesday, August 21, 2019 9:15 PM

All replies

  • May I know how are you trying to add messages to Azure Storage queue?

    Can you try again adding messages through Storage explorer and let me now the status?

    Based on your error message "The specified marker is invalid." it states

    You may also try Perform Azure Queue storage operations with Azure PowerShell

    If the issue persists, please do provide a screenshot of the error (after concealing any private) for better understanding.

    Hope this helps!

    Kindly let us know if the above helps or you need further assistance on this issue.
    ------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" and Upvote on the post that helps you, this can be beneficial to other community members.



    Thursday, August 22, 2019 11:32 AM
  • Yes, I can put messages in the queue using a storageConnectionString, no problem (of course it does work with the storage explorer):

    storageAccount = CloudStorageAccount.Parse(storageConnectionString);

    CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
    CloudQueue queue = queueClient.GetQueueReference(queueName);
    queue.CreateIfNotExists();
    CloudQueueMessage cloudQueueMessage = new CloudQueueMessage(messageContent);
    queue.AddMessage(cloudQueueMessage, etc..;

    and I have another policy to retrieve messages from queue, which it DOES work. Anyway, I don't want to go to such extent and use the storage account to put messages in the queue (as I have other queues and so on...), I want to use SAS for that, I created a policy and copied the URL from the Storage Explorer:

    storageUri = https://mydomainname.queue.core.windows.net/myqueuename?si=queue_producer_20181023_085853&sv=2018-03-28&sig=autogeneratedsig

    and when trying to use

    var queueClient = new CloudQueueClient(new Uri(storageUri), null);
    var queue = queueClient.GetQueueReference(queueName.ToLowerInvariant());
    var messageProperties = messageConverter.CreateMessage(message);
    queue.AddMessage(cloudQueueMessage, etc...;

    this is the error I get:

    InnerException = {"The remote server returned an error: (400) Bad Request."}

    and if I start adding "&spr=https&sip=0.0.0.0-255.255.255.255" just to be sure I enforce https and etc..

    I receive "The remote server returned an error: (403) Forbidden."


    Thursday, August 22, 2019 12:12 PM
  • You have a URL to a queue, so you need to pass it to the CloudQueue constructor, not the CloudQueueClient constructor.

    So,

    var queue = new CloudQueue(new Uri(storageUri));

    Hope this helps! 

    Kindly let us know if the above helps or you need further assistance on this issue.
    ------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" and Upvote on the post that helps you, this can be beneficial to other community members.

    Thursday, August 22, 2019 3:30 PM
  • @Ciocanul Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Friday, August 23, 2019 5:51 AM
  • @Ciocanul Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.

    Monday, August 26, 2019 7:14 AM
  • @Ciocanul Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Thursday, August 29, 2019 6:52 AM
  • @Ciocanul Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Wednesday, September 4, 2019 5:12 AM
  • @Ciocanul Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Wednesday, September 25, 2019 2:32 PM