In my previous blog post, How to Build an Azure Logic App
, we learned why building Logic Apps can be useful and how to build them in Azure. While Microsoft Azure Logic apps can be used intuitively to connect APIs together, once you create parent/child apps you will eventually want to be able to enable/disable them automatically, that way you can check to make sure you don’t have a logic app that is running away with an infinite loop somewhere and racking up charges on your Azure account. It’s also helpful to use in different workflow scenarios where you want one process disabled and enable another process in reaction to input that comes in.
At first, I thought this would be a common practice given the widespread use of Logic Apps, but I found that outside of going into Azure and clicking the disable button on the app itself, it didn't seem possible. After digging around for a bit, I found that it wasn't just possible, but easy to do via the Design tab on the logic app itself.
I've added some simple steps to disable the Logic app that you want.
- Add an action to the app that you want to use to disable your other app
- Search for Invoke in the connectors and actions. You want to choose the "Invoke resource operation" Action. Keep in mind that while this feature is really cool, it is only a preview feature, which means that you shouldn’t use it in production quite yet in case something changes later on down the road.
- Add the parameters in the screenshot below to set it up right.
The only thing you need to change is the Short ResourceID. You can find that by going to the App you want to disable, clicking on the Properties tab and looking at the resource ID. You only need to grab the URL after Microsoft.Logic.
Once you do this, it should automatically disable the application. If you need to enable it, just follow the same steps, only change the Action name to "Enable" and it should work!