0
votes

I want to be able to use Logic Apps to put/post messages in an Azure Storage Queue, because I want to make use of the Managed Identity option that HTTP Logic App acion provides.

I have a Logic App that uses HTTP action to post XML messages to the queue and I have a "Put a message on a queue" action that puts JSON message to the queue for debugging purposes.

My ultimate goal is to be able to use the HTTP action with Managed Identity as Authentication but be able to post JSON messages to the queue like the "Put a message on a queue" action is able to.

enter image description here

enter image description here

2
Are you defining the request body in the 1st screenshot (HTTP Post)? - Gaurav Mantri
Yes I will be providing some values. This was just a test value to see that it works with XML - Oliver Nilsen

2 Answers

0
votes

You can certainly send JSON as message body. In fact you can send any text. You just have to ensure that the text you're sending as message body must be XML safe e.g. replace < with &lt; etc. Generally Base64 encoded string messages are sent to ensure this.

From the REST API documentation:

A message must be in a format that can be included in an XML request with UTF-8 encoding. To include markup in the message, the contents of the message must either be XML-escaped or Base64-encode. Any XML markup in the message that is not escaped or encoded will be removed before the message is added to the queue.

0
votes

Here is what worked for me:

  1. Enabled "Managed Identity" on the Logic App.

  2. Added Storage-Queue-Contributor permissions on the storage queue.

  3. Used utcnow('R') to get this date format ("Tue, 08 Sep 2020 12:03:08 GMT") for x-ms-date HTTP header (no doc from MS about this).

  4. Inserted JSON data inside

    <QueueMessage> 
        <MessageText>
        {
          "car": "Audi",
          "year": 1983
        }
       </MessageText>  
    </QueueMessage>
    

Final result in Logic App designer: enter image description here