4

Using Azure Functions, I'd like use the properties from a dequeued message as arguments in my Bash script. Is this possible? And if so, how? It seems documentation on Bash azure functions is a bit sparse.

I have looked at:

  • This documentation on binding to custom input properties. It gives C#/Javascript examples, but no bash samples.
  • And this GitHub sample with a similar Batch function. However, after trying to apply the similar concepts to my function, I've come up short.

Here is my setup:

Functions.json

{
  "bindings": [
    {
      "name": "inputMessage",
      "type": "queueTrigger",
      "direction": "in",
      "queueName": "some-queue",
      "connection": "AzureWebJobsStorage"
    }
  ],
  "disabled": false
}

Run.sh

echo "My name is $FirstName $LastName"

Sample Queue Message

{ 
    "FirstName": "John",
    "LastName": "Doe"
}

Actual Result

My name is:

What I'm hoping for

My name is: John Doe

Any thoughts on how to accomplish this, either by updating Functions.json or Run.sh?

Earl
  • 43
  • 1
  • 3

1 Answers1

1

For bash queue trigger queue message returns as string and you need to parse JSON yourself in run.sh. Note bash queue trigger is experimental. I think it's not easy to implement bash json parser as you can't install third party libs like jq in function app sandbox.

You can easily extract json objects from queue message using other languages (JS/C#/Powershell)

Alexey Rodionov
  • 1,436
  • 6
  • 8