Search code examples
webhooksazure-analysis-servicesazure-runbook

Catch error when analysis services refresh fail through webhook ADF


I have a runbook that is called multiple times from ADF but with different parameters. What it does is that it just refresh different analysis services. I use the web activity in ADF

enter image description here

With POST method and in the Body i state which analysis service i want to refresh. Here is the code for the runbook: enter image description here

The runbook says that all jobs is completed enter image description here

But one of them have actually failed: enter image description here

Does anyone know how i can catch this error? Now i have no way of knowing that this has failed, except for going in to every job and look in details.


Solution

  • Does anyone know how i can catch this error? Now i have no way of knowing that this has failed, except for going in to every job and look in details.

    • Yes, this is the way of using Azure Automation Accounts.
    • Here Job completion means executing the PowerShell code, but it doesn't means you are getting desired output.(PowerShell commands gives errors, outputs, etc)

    enter image description here

    • This is a limitation in Automation Accounts, you need to go inside job to get to know about the status of job.

    Alternatively,There is another way to get to know the errors using Inbuilt queries in Logs Section Of Automation Account.

    enter image description here

    You can use below query which I have taken from Microsoft-Document:

    AzureDiagnostics 
    | where ResourceProvider == "MICROSOFT.AUTOMATION" and Category == "JobStreams" and StreamType_s == "Error" 
    | project TimeGenerated , RunbookName_s , StreamType_s , _ResourceId , ResultDescription , JobId_g
    

    Error is in Result description:

    enter image description here

    Note( to get logs of jobs you need to enable logging and tracing in inside the runbook):

    enter image description here