Enable Logic Apps Diagnostics within ARM Template

In my current project we are using Log Analytics (OMS) to log runs from Logic Apps. From the logged runs we get alerts when a Logic App run is failed. To enable Logic Apps diagnostics we first used a PowerShell script, run from a VSTS release step.

The problem with this is that both the log and metric are enabled.

Enable Logic Apps Diagnostics
Logic Apps Diagnostic Settings

Since we did not need the Metrics to be enabled we had to do it in another way. After some investigation on the net we found out that it was possible to add it to our ARM template.

Enable Logic Apps Diagnostics within ARM Template

The “resources” array should be within the “Microsoft.Logic/workflows” resource in the template, same level as “type”, “name” etc.

After deploying the template the metric checkbox is now unchecked.

Metrics unchecked
Logic Apps diagnostic settings metrics disabled

This example shows only how to configure diagnostic settings for Log Analytics. It is also possible to configure diagnostic settings for Storage Account or Event Hub.

More information

More detailed information about Logic Apps diagnostic settings can be found at Microsoft Azure documentation.

The diagnostics settings are now included in the LogicAppTemplateExtractor by Jeff Hollan, (my first contribution to a github project).

If you like it...

List servers in Azure API Connections with Powershell

My customer asked me to create a list of all servers that our Logic Apps are either receiving from or sending to. In BizTalk this is easy, just go to All Artifacts and choose Send Ports or Receive Locations. In the Azure Portal there is no such a thing (as far as I know). Instead you must check the Azure API Connections and choose “Edit”. On the edit page you will see the properties, “Host Server Address” in this case.

Azure API Connection

apiconnection_sftp
API Connection SFTP

Solution with Powershell

So to be able to complete my task I wrote this script in Powershell. The script fetches all the resources within an subscription and for each API Connection it gets the information needed.

If you like it...

Search for runs in Logic Apps with PowerShell

When you have a polling Logic App and most of the polling are “empty”, meaning that no data were found and processed, it can be hard to find the runs where data actually was processed.

It is not fun to search for these processed runs manually and this is where you should think “Let’s do some scripting”.

First let’s check out two runs from the Logic App. The first one does not find any files matching what we are looking for. The output of the action Filter array is empty.

In the other run we got a match on the file we are looking for. The action Create_file is run and that is the action we will use in the script to know if content has passed the Logic App.

To find the runs which actually processed the data you can use this PowerShell script.

The script is based on  Get-AzureRmOperationalInsightsSearchResults cmdlet so Log Analytics and OMS must be enabled, You can read more about how to get started with Log Analytics and OMS in the Microsoft Azure Documentation pages.

Some input are required by the script:

  • ResourceGroup – the name of the resource group where the OMS workspace is located
  • Workspace – the name of the OMS workspace
  • Workflow – the name of the Logic App workflow
  • Action – the name of the actual action within the Logic App

The output from the script includes the datetime, status and the actual runId, which can be used when searching for more details in the Logic Apps runs history or with another script (maybe in a future blog post).

This is one way of doing it, of course you can go in to the OMS portal and do the search but I am too lazy for that, PowerShell scripts to the rescue…

If you like it...