Recently I was asked to create an HTTP Endpoint that could a user could call to disable a Logic App.
At first I thought about doing this as an Azure Function, but thought first I’d try it using a Logic App.
Albert Hovingh’s article, Disabling Logic Apps from Other Logic Apps, pointed me in the right direction.
To get started I created a resource group,
I then created the Logic App that I wanted to enable and disable, I called it
I used the Request + Response template.
In order to enable/disable the Logic App I was going to need to create a Service Principal.
Copy the outputted values, you will need them for our Logic App that will disable/enable the other Logic App.
If you fail to copy the outputted values, you will need to get them from the Azure Active Directory blade, under App Registrations.
I then gave the Service Principal Contributor access to the Logic App,
Finally, I created the logic app that would be responsible for enabling/disabling the previous logic app I created, I called this logic app
I started with a Blank Logic App.
I added a Request trigger for When a HTTP request is received.
I added an Azure Resource Manager action, per Albert Hovingh’s article, Disabling Logic Apps from Other Logic Apps, and set the Action to
I change the connection to Connect with Service Principal and enter the values from the service principal I just created.
For Client ID use the
appId and for the Client Secret use the
Originally I made it so the action could be passed via the body of the HTTP Request, this way you could use a single Logic App to enable and disable the Logic App, but there was one more additional requirement, that caused me to the remove that functionality, the Logic App would need to be enabled again after 15 minutes.
easy not difficult to accomplish this right in the Logic App that was handling the disabling.
I simply added a Schedule action, set the Count to
15 and the Units to
I then added another Azure Resource Manager action, using all the settings from the previous action, except this time, I set Action to
This worked great! And I did it without any code, keep in mind that I have a bias towards writing code! 😊