Azure Logic App - Recurring Trigger Not Recurring - azure

I have a simple Azure logic app that starts with a trigger step, which is "When One or More BLOBS are Added" to a specific Azure storage container. It has an interval setting to check for new files every 3 minutes. It then calls one more step to send a message to a service bus queue. In My Logic App Designer there is a "Run" button, and in the Overview panel of the Logic App, there is a "Run Trigger" command. If I run either of these from the Azure Portal my job runs continually as expected.
My issue is that once I leave the portal, my logic app no longer runs. I assumed that the Interval setting on the Trigger Step (Step 1) of every 3 minutes meant just that. I read that I can put a Scheduler step as step 1, but how does that interact with the 3 minute interval setting of the BLOB trigger?
My goal is to have the logic app run every 3 minutes, looking for any new files placed in the BLOB container since the last run, and then sending the service bus message as a step 2. Note that I also have an Azure Scheduler that I can use if that is a better solution (i.e. triggering the job wit ha web hook).
I appreciate the help!!

Related

Scheduling a long running task in Azure

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.

Logic App running twice with alert monitoring

I have the following Logic app:
This logic app is triggered when my connection goes above 120, it runs a powershell script which reduces the number of connection. The problem that I am facing is once it runs and the connections go back down from 120 or above the logic app is triggered again because the alert is being triggered, this generally happens minutes from each other. Is there a way I can tweak this logic app to make sure it wont trigger again for maybe 10 minutes after it has been triggered, to stop my powershell script from running twice?
You could have persistent value - stored in any of one of cloud services - let me take azure blob for instance.
The immediate running instance can persist the current running time in the Azure Blob storage.
So next instance is triggered - checks for the last run time from the blob - if it is less than 10 minutes. Your logic would be to skip the execution of the PowerShell.
The overall logic will look like below :
Note :
The logic app doesn't have a concept of persistent storage built-in. You can use AzureSQL, CosmosDB,Sharepoint, Azure Storage etc. using their inbuilt connector to achieve this persisting storage functionality.

Azure container instance, to stop after data processed and start back for every one hour

I have feed job as a pod on AKS, triggered by Logic App for every one hour. Purpose- The data will be processed and updated on Azure blob storage. Planned to move this to Azure container instance(ACI) , so have automated via Jenkins to deploy the ACI and it works as expected. Now looking to stop Azure container instance once the data processing is completed and start back prior to an hour. so logic App can initiate the trigger. Shall we have job in Jenkins to delete ACI after 10 mins and run the build prior to an hour or
What will be best approach to stop/delete ACI, once the data is uploaded on storage account and start back prior to an hour?
I have completed this request, took the approach as below:
Initial build and deployment is taken care by Jenkins to AKS via Virtual Node to ACI.
Build a Logic App with ACI connector to start and then trigger the API.
Another Logic App with event grid to trap the file is modified on storage account and then stop the ACI via ACI connector.
This ensures my ACI is stopped once the work is completed and start back when needed.

Long running scheduled WebJob Aborted by Azure

I have a Azure Scheduled Web Job on Azure WebApp. Inside web job, it downloads the excel file from azure blob and read (25 - 30 k records in a file), then it iterate through loop to insert's records in database. Now, when we schedule (Schedule time: 18 hrs) first time the job ran successfully and processed all records from file without any interruptions (between this time site was accessing). But, next time it fails (Aborted) without any reason (No one was accessed site. may be in idle state).
WebJob Abort Status
There is no any indications when i looked into logs. However, first schedule ran successfully and shows success status later all are in Aborted status, Why?
Success
Also done with below settings in webapp:
stopping_wait_time - 3600
WEBJOBS_IDLE_TIMEOUT - 3600
SCM_COMMAND_IDLE_TIMEOUT - 121
Per Azure's documentation,
Always On. By default, web apps are unloaded if they are idle for some
period of time. This lets the system conserve resources. In Basic or
Standard mode, you can enable Always On to keep the app loaded all the
time. If your app runs continuous web jobs, you should enable Always
On, or the web jobs may not run reliably.
So there is no promise from Azure Web Apps for your WebJob to continue running more than 20 minutes. If you need to rely on that you'll need to enable Always On. To enable it. See below.
In the Azure Portal, navigate to your App Services.
Click Application Settings in the SETTINGS menu.
Turn Always On to on, then click Save.
Here the picture:
If you are using the free tier of Azure, maybe this thread will help you: How can I keep my Azure WebJob running without "Always On".

Azure - Triggered by Q-message

In our app (Azure hosted) we produce invoices, these have to be injected into an on premise accounting software. It is not possible to host an API that would be reachable from the Azure to post the invoices to.
Is it possible to create an exe that runs on-premise an that get's triggered by Azure Q-messages like WebJobs can ? Once triggered retrieve the invoice from a blob-storage-object.
Other suggestions are also welcome.
One important thing I want to mention is that even WebJobs poll the queue at predetermined interval (I believe the default is 30 seconds). Azure Queues don't support triggering mechanism like you think.
What you want to do is entirely possible though. What you could do is write a Windows Service, that essentially wakes up at a predetermined interval and checks for messages in the queue. If it finds messages, then it processes those messages otherwise go back to sleep again.

Resources