We have over 20 functions inside one function in each environment and yes I'm aware of the timer trigger. What I'm looking for is a way to turn on the azure function resource itself (not the functions inside the function) at a specific time of the day, and turn off the azure function resource itself at a specific time of the day.
We tried looking for a way to do this in through azure devops CI pipeline (which is usually how we turn on and off the azure function resource itself) as you can see here but its not yet supported atm
You can use the Azure App Service Actions within a Logic App to Create schedule-based and recurring automation workflows with Azure Logic Apps.
These actions can also (re)start or stop an Azure Function App.
The example in the screenshot runs once every day at 12:00 and starts the Function App called gtmooaf01.
Related
Is it possible to get the name, type, associated resource group, trigger time, trigger type, and trigger source for all Azure Functions within a subscription? We have set up a number of Azure Functions over time but they are not cleanly organized or properly documented, so we only know that we have a lot of Functions executing but we don't know when they're scheduled to execute, what triggers their execution, etc. Having this information would help us better balance jobs and more effectively plan how to add and schedule other automated tasks.
Yes, you can get to know the trigger, which is triggering at which time, by enabling application insights while creating your function app like below:
Then when you run the trigger, you can check in logs of appinsights of function app which trigger is running like below.
You can use kusto query to get the details of functions running:
Another query:
Over here you will get to know about the logs of function app:
I am very new in Azure. I have got a requirement to extract all ADO Workitems for all projects under the domain. I did it using WIQL and personal access token in C#. But the extraction takes around 1 hr to fetch everything for the last few years. Thats fine..
But the trouble is I have no idea how to make it schedule to run early morning every day (Outside business hours). Earlier we have got a dedicated server and thus I made the app a console app and used Task scheduler to run that every morning. But in Azure, please suggest a best and easy solution.
Developed in .NET Core 3.0
Azure webjobs will solve this problem you can enable the trigger to run automatically. Follow below article for step by step:
Micorsoft Document Reference
Using CRON jobs you step the schedule your task early morning
For this requirement, you can create a azure timer trigger function with cron expression which you want. Do your task in function code, the function will be executed according to the cron expression.
When you create the function app, please choose app service plan but not consumption plan because function in consumption plan can just run maximum 10 minutes and you mentioned your task will take about 1 hour. So choose app service plan and set the value of property functionTimeout as -1 in the host.json of your function.
By the way, you'd better also enable "Always on" of your function app because you need the function long running.
What is the best way of using Azure technology (azure function apps, durable function app, azure web jobs, ?) to get a schedule from a database depending on the specific task that needs to be performed.
The schedule that would be read from the database, would then be converted to a CRON expression. I have hourly, daily, and weekly triggers to run specific tasks.
The schedule within the database could possibly change, hence why it would need to be dynamic.
I could create individual specific function apps (over 20) but wanting it to be more flexible and dynamic.
How would i go about this? what azure tech would i use?
Thanks
Two options I can think of, depending on the details of what you're after:
Use timer-triggered Azure Functions with the %appsetting% format for the timer expression. Then have a separate function that's timed to run regularly or triggered when the schedules update, get the current schedule and update the function app settings with any changes to the CRON expressions (using a managed identity that gives it the necessary permissions).
If you're just running on the hour/day/week, you could have a function that runs every hour, reads the current schedule and triggers any functions that are scheduled for that time (basically your own simple timer).
I have a function app with three Timer Trigger functions in it. I want to use the staging/production functionality provided by the Slots (preview), so I set up the VSTS deployment for two separate branches. The primary function app polls master and the slot polls a branch called staging.
The problem is that when I start the function app, the main functions schedule and run, but the Slot functions don't seem to get scheduled to run at all. Things I've tried:
I set the hosts.json file for each with a separate 'id' field to avoid a conflict on the locks that determine whether or not they can run. Looking in the storage account, I can see a folder for each app (the main and the slot) and a folder for each function, which I think means they shouldn't be using the same locks.
Use a separate storage account for the Slot app
Stop the main function app while keeping the Slot app running
Can anyone tell me what might be wrong with my setup or if there's a known bug with Slots (preview) preventing this from working?
I have created an azure service which is responsible for below task:
(1) Access the blob containers and download the files from there.
(2) Extract some data from downloaded files
(3) Stored the extracted data to an Azure SQL Server
I want to run this processing after every 7 days. Is there a way to achieve this? or can I use any other option than cloud service to achieve the above goal?
I would recommend you to use Azure Function as its Timer-based processing (Timer trigger) feature is able to fulfill your requirements.
Timer triggers call functions based on a schedule, one time or
recurring.
Reference: Azure Functions timer trigger, Azure Functions Pricing
Another great advantage of using Azure Function for your scenario is its pricing model.
Azure Functions consumption plan is billed based on resource
consumption and executions.
Consumption plan pricing includes a
monthly free grant of 1 million requests and 400,000 GB-s of resource
consumption per month.
Certainly not natively with the Cloud Service itself. I mean, you can obviously code it so it performs some task(s) and sleeps for 7 days, but you will pay for all of that time, that makes no sense
You can use Azure WebJobs, Functions and Scheduler for this purpose, or you can create a PowerShell\Cli or something else cron task\task scheduler to turn on your Azure Cloud Service, wait for it to finish processing and turn it off. But that seems like a lot of extra effort, I'd rather go with Scheduler or Functions.