You can use Get-AzAutomationJob command to get the jobs(run history) of your runbook. Below is my runbook example:
$User = "my user name"
$PWord = ConvertTo-SecureString -String "my password" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
Connect-AzAccount -Credential $Credential
$jobs = Get-AzAutomationJob -AutomationAccountName "<automation account name>" -ResourceGroupName "<resource group name>" -RunbookName "<runbook name>"
Then use $jobs[0].StartTime
to get the latest running record time and check if it in 5 minutes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…