Reputation: 4074
I am creating an Arm template for a logic app. This logic app needs to delete some old entries in azure table (say 10 or 20 days old).
In my arm template, if I do this, it works.
"queries": {
"$filter": "Timestamp le datetime'@{addDays(utcNow(),-31)}'"
}
But ideally I want to do this:
"queries": {
"$filter": "Timestamp le datetime'@{addDays(utcNow(),parameters('RetainDay'))}'"
}
Basically use a parameter to control the amount of days to check. I define this parameter as:
"parameters": {
"RetainDay": {
"type": "int"
}
}
When I deploy this, the parameters('RetainDay') isn't replaced to the parameter value. Instead it just stays same as:
Timestamp le datetime'@{addDays(utcNow(),parameters('RetainDay')
So I must be using the wrong syntax.
Can someone point it out?
Upvotes: 1
Views: 2294
Reputation: 14324
I see your template only set the parameter retionday
type, you don't set the value. So go to parameter set the defaultValue
like the below picture.
And I just use the this Filter Query Timestamp le datetime'@{addDays(utcNow(),parameters('retionday'))}'
, it will replace the time.
So please have a try, hope this could help you.
Upvotes: 0
Reputation: 72151
You need to use a concat()
function to achieve string concatenation and variable expansion:
"$filter": "[concat('Timestamp le datetime\'@{addDays(utcNow(),', parameters('RetainDay'), ')}\'')]"
i think you can escape '
with \
, if not, you can create a variable with the value '
and use that instead.
Upvotes: 0
Reputation: 1984
You need to connect the 'Logic Apps template parameter' together with the 'ARM deployment template parameter', as much as it looks like the one and same variable, it is two parameters that work together. In my solution, I have a parameter called 'CustomVariableName'
Declaring the CustomVariableName in the "logic app code" and in the ARM template
Postman POST response from hitting the HTTP trigger(instead of value: 'DefaultValue')
Upvotes: 2