Reputation: 397
I have a logic app which is triggered when a blob is added or modified. It checks every few minutes. Given that logic apps are charged for each run of the Trigger (I think), how can I stop the Trigger running at weekends? I can't see anything on here
Upvotes: 0
Views: 835
Reputation: 146
You can also use Powershell to disable you Logic App. One option to run it is from Azure Functions with Managed identity, which you can give permissions to the required Logic Apps.
Set-AzLogicApp -ResourceGroupName "MyResourceGroup" -Name "MyLogicApp" -State Disabled -Force
And to enable, just switch the State option to "Enabled"
Upvotes: 1
Reputation: 15754
You can create a azure timer trigger function with the cron expression to schedule the function run every Friday evening and call this api in the timer trigger function to disable your logic app.
For example, the cron expression could be:
59 59 23 * * Fri
Then create another timer trigger function with the cron expression to schedule the function run every Monday morning and call this api in the timer trigger function to enable your logic app.
For example, the cron expression could be:
0 0 0 * * Mon
Another solution:
You can add a condition after the blob trigger(before the actions which the logic will do), shown as below:
The expression of "dayOfWeek()" is:
dayOfWeek(utcNow())
In the response of dayOfWeek() method, Sunday --> 0, Monday --> 1.
So in the conditon above, most of the actions will just run on Monday to Friday. On Saturday and Sunday, you will just pay for the trigger but not for most of the actions in your logic app. But you need to pay attention to the time zone if use this solution. You an know more information about the pricing of logic app in this link.
By the way, I think the second solution may suit you better. Because in first solution we can't call the api easily in azure function, we have to get the access token(in implicit flow) before request the api.
Upvotes: 1