Use Azure Scheduler to Enable/Disable Your Azure Resources On A Set Schedule

There may comes time when you want to enable/disable your Azure resources on a pre-defined schedule for many reasons, in this post, I want to share one such example using Azure Logic Apps.

Many of our Azure Logic Apps customers created workflows with a polling trigger (a type of trigger that performs the check on a set interval). Because Logic Apps charges based on number of executions, depending on the workflow scenario, there may be times when disable such Logic Apps outside of business hours make sense.

While Logic Apps doesn't support this natively yet, it's very easy to do with the help of Azure Scheduler, let's get started.

First, you need to set up a service principle, this can be done either via the Portal, PowerShell, or CLI. You will need to record Tenant, Client ID, and generate a Key, I called mine "LogicAppsManagement".

Next, find the Logic App that you want to apply the schedule, under "Access control (IAM)", add a new user. Select "Logic App Operator" for role,  and search for the name of the service principle you just created as the user, in my case, it's "LogicAppsManagement".


Last, create a Scheduler job (and Scheduler job collection if you don't have one already, which is just a container for jobs) with the following action settings:

Action: Https

Method: Post

Url:{subscriptionGuid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{LogicAppName}/Enable?api-version=2016-06-01 (you can find the documentation for this RESTful API here)

Body: Leave empty

Headers: Leave empty

For Authentication settings:

Authentication type: Active Directory OAuth

Tenant: Tenant value obtained in step 1.

Client id: Client id obtained in step 1.

Secret: Secret obtained in step 1.


Scheduler Job Action

Now configure schedule the way you want. For me, I choose to enable my Logic App during workdays at 8am.

Scheduler Recurring Settings

Now, create another Scheduler job, but change the recurrence to when you want to disable the Logic App, and update the Url accordingly:{subscriptionGuid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{LogicAppName}/Disable?api-version=2016-06-01

Skip to main content