In a previous article, Adventures with Logic Apps: Enabling/Disabling a Logic App from Another Logic App, I created a Logic App that would disable a Logic App and then re-enable it after a specific time frame had elapsed.
One of my peers pointed out that the Logic App should NOT disable the Logic App if it was already disabled.
Good point … makes sense.
I added an Azure Resource Manager action to Read a resource. I update the properties to point to the Logic App that I want to check state for.
That action gets me all the information for the resource, in this case my Logic App.
The state of the Logic App is in the Properties, so we will need to parse it. To do this, I add a Parse JSON action, select the Properties properties and paste in the following schema:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
{ "properties": { "accessEndpoint": { "type": "string" }, "changedTime": { "type": "string" }, "createdTime": { "type": "string" }, "parameters": { "properties": {}, "type": "object" }, "provisioningState": { "type": "string" }, "state": { "type": "string" }, "version": { "type": "string" } }, "type": "object" } |
I now add a Control action and add the supporting condition to check to see if State is Enabled
.
Lastly, I drag and drop my steps for disabling and enabling the Logic App into the if true condition.
That’s it! Works great!
Discover more from Matt Ruma
Subscribe to get the latest posts sent to your email.