AzureMonitorLogs PowerApp Connector

Iron Contributor

I cannot work out the correct information to provide the AzureMonitorLogs.QueryData Connector for PowerApps.

 

I want to run a query against my Log Analytics/Monitor Workspace, get the results and bring them back into my PowerApp.  I'll then present the data in the PowerApp.

 

Currently i am trying this on a Button OnSelect property.  On button click, the query runs, and populates a Table with the data.

 

 

 

ClearCollect(res,
AzureMonitorLogs.QueryData(
    "xxyyzz",
    "the name of my resource group hosting the analytics workspace",
    "Microsoft.OperationalInsights/workspaces",
    "the name of my workspace",
    "",
    "SigninLogs | where TimeGenerated > ago(24h)"
    )
)

 

 

 

 

Official Connector documentation is here. https://docs.microsoft.com/en-us/connectors/azuremonitorlogs/#run-query-and-list-results

 

I am struggling to access the data in the resulting Table and use the data in various controls, namely a Gallery Control.

 

Here is a real request response from the PowerApp to Azure Monitor.  How do i now parse that in PowerApps and make use of it?

 

 

 

{
  "status": 200,
  "duration": 2572.79,
  "dataSource": "AzureMonitorLogs",
  "responseSize": 118,
  "controlName": "Button2",
  "propertyName": "OnSelect",
  "nodeId": 10,
  "formulaData": {
    "script": "ClearCollect(res,\nAzureMonitorLogs.QueryData(\n    \"<redacted>\",\n    \"<redacted>\",\n    \"Microsoft.OperationalInsights/workspaces\",\n    \"<redacted>\",\n    \"\",\n    \"SigninLogs | where TimeGenerated > ago(24h) | project TimeGenerated, UserPrincipalName | limit 1\"\n    ).value\n)",
    "spanStart": 18,
    "spanEnd": 349
  },
  "data": {
    "context": {
      "entityName": "Button2",
      "propertyName": "OnSelect",
      "id": 5661,
      "nodeId": 10,
      "diagnosticContext": {
        "dataOperation": {
          "protocol": "rest",
          "operation": "QueryData",
          "dataSource": "AzureMonitorLogs"
        },
        "formula": "ClearCollect(res,\nAzureMonitorLogs.QueryData(\n    \"<redacted>\",\n    \"<redacted>\",\n    \"Microsoft.OperationalInsights/workspaces\",\n    \"<redacted>\",\n    \"\",\n    \"SigninLogs | where TimeGenerated > ago(24h) | project TimeGenerated, UserPrincipalName | limit 1\"\n    ).value\n)",
        "span": {
          "start": 18,
          "end": 349
        }
      }
    },
    "request": {
      "url": "<redacted>",
      "method": "POST",
      "headers": {
        ...
      },
      "body": "SigninLogs | where TimeGenerated > ago(24h) | project TimeGenerated, UserPrincipalName | limit 1"
    },
    "response": {
      "duration": 2572.79,
      "size": 118,
      "status": 200,
      "headers": {
        ...
      },
      "body": {
        "value": [
          {
            "TimeGenerated": "2022-03-29T02:25:44.575Z",
            "UserPrincipalName": "<redacted>"
          }
        ]
      },
      "responseType": "json"
    }
  }
}

 

Now back in PowerApps, after clicking the button, the dots fly across the screen and then .. silence.

 

If i go check the res Collection, i can see an empty Table, well at least i think it is empty?

 

Any clues?

 

2 Replies
Any ideas or takers on this?

Has anyone used the Azure Monitor Logs Connector in PowerApps before?
In the mean time, i have used a Flow to retrieve the logs using the same Azure Monitor Logs Connector and then returning the results to the PowerApp. This is less than ideal, but it works for now.