0

I'm creating a Job in Azure Scheduler Job Collection. The idea is to drop a message to a queue at a scheduled time. I followed this link to configure the https job but I'm stuck at a point where I need to add a Request Header x-ms-date (or Date) which needs to be "no older than 15 minutes" as per the MS docs.

enter image description here

I have to use the https action type because Azure Scheduler Portal doesn't support Queues created by ARM. Although this can be achieved using Scheduler SDK, we might opt for it as a last resort.

Please let me know if this is possible through the Azure Portal.

Thanks

1 Answers1

3

Instead of using Queue URL, you can create a Shared Access Signature (SAS) on the queue with at least Add permission and use that SAS URL. You would use a URL like the following:

https://{account-name}.queue.core.windows.net/{queue-name}/messages?messagettl=3600&se=2016-11-30T18%3A30%3A00Z&sp=raup&sv=2015-12-11&sig={sas-signature}

You would need to specify Content-Type request header which you can set to application/xml.

enter image description here

Once you do that, you should see messages showing up in the queue.

enter image description here

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thanks. Shared Access Signature did the trick. I also had to remove the Authentication Settings that I had put. This is much simpler. – Flemin Adambukulam Nov 30 '16 at 15:17
  • On a different but not totally unrelated note, could you help me with why Azure Scheduler is parsing the XML message that I'm passing in the request message? For e.g Sample in the request message arrives in the queue as "Sample". I want the whole xml message. Thanks a lot in advance. – Flemin Adambukulam Dec 01 '16 at 09:42
  • The message body should be XML safe. One way to do it would be to replace `<` with `<` and `>` with `>`. So the message content would be `<a><b>Sample</b></a>`. Other way you could do it is to convert the message body in base64 encoded string and use that. On the receiver end you would then need to decode the encoded string. HTH. – Gaurav Mantri Dec 01 '16 at 10:34
  • Its working for me now. I wonder why this is not mentioned in the Microsoft docs that I referred. Thanks a lot. – Flemin Adambukulam Dec 01 '16 at 11:29
  • I tried the Base64 Encoding way too and it looks like we don't have to decode the message at the receiver end. I'm getting the actual xml message on the queue and not the encoded message. – Flemin Adambukulam Dec 01 '16 at 11:51
  • 1
    Regarding your 1st comment about the missing documenation, it is indeed mentioned at https://learn.microsoft.com/en-us/rest/api/storageservices/fileservices/put-message#remarks: **`To include markup in the message, the contents of the message must either be XML-escaped or Base64-encode.`**. Regarding your 2nd comment, it depends on which tool you're using to view the messages. Some tools will assume that the messages are always Base64 encoded and converts them always (thus will fail if you send unencoded text) while some tools are smart and do the conversion. – Gaurav Mantri Dec 01 '16 at 11:59
  • My bad on the comment on documentation. On the second comment I viewed the message using storage explorer. Thanks a lot for the extended comments. – Flemin Adambukulam Dec 01 '16 at 12:26
  • You're welcome. I believe storage explorer will fail to show the message if you create them without encoding. Please see this thread: http://stackoverflow.com/questions/40551430/rest-add-message-to-azure-storage-queue-without-base64-encoding. – Gaurav Mantri Dec 01 '16 at 13:10
  • No it didn't fail when I put the message without encoding. In fact I put the exact xml-escaped string from the link you shared on my request and the queue received it properly. In my case the Webjob, which was reading the queue message, was failing with the same error as @thllbrg was getting. I'm sure Storage Account Queue gets the message properly. – Flemin Adambukulam Dec 01 '16 at 13:35