Get ADLAJob not working in azure run book


  • I am trying to create a PowerShell Script which generates a list of the all the U-SQL Jobs failed over a night process.

    The command works in PowerShell, however when trying to run it within azure automation I get the following error.

    Cannot find the 'Get-AdlJob' command. If this command is defined as a workflow, ensure it is defined before the workflow that calls it. If it is a command intended to run directly within Windows PowerShell (or is not available on this system), place it in an InlineScript: 'InlineScript { Get-AdlJob }'

    The script is 

    workflow U-SQLDEV
    [Parameter(Mandatory=$true)] $AppID,
    [Parameter(Mandatory=$true)] [String] $PlainPword,
    [Parameter(Mandatory=$true)] [String] $TenantId
    $PWord = ConvertTo-SecureString -String $PlainPWord -AsPlainText -Force
    $Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $AppId, $PWord
    # List jobs submitted in the last day.
    $d = [DateTime]::Now.AddDays(-5)
    Get-AdlJob -Account *****-SubmittedAfter $d -Result Failed,none

    Any ideas why this is not working in azure automation?
    • Edited by J_J_D Saturday, August 18, 2018 4:49 PM
    Saturday, August 18, 2018 4:48 PM

All replies

  • How does the authentication look like in your runbook?

    An example of that would be like below:

    $Conn = Get-AutomationConnection -Name AzureRunAsConnection
    Add-AzureRMAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint

    Monday, August 20, 2018 6:20 PM