일정에 따라 런 북을 실행하고 싶지만 마지막 작업이 완료되지 않은 경우 종료합니다 (즉, 일정이 2 시간이고 작업이 2.5 시간이 소요되고 다음 작업이 소요될 경우). 실행해서는 안됨).Azure Runbook에서 작업 상태 가져 오기
Get-AzureAutomationJob을 사용하여 마지막 작업 상태 (https://azure.microsoft.com/en-gb/documentation/articles/automation-runbook-execution/#retrieving-job-status-using-windows-powershell)를 얻으려고했지만 작동하지 않습니다. 나는 모든 전제 조건을 얻기 위해 가입 등이 필요하다고 생각한다.
"Get-AzureAutomationJob : 자동화 계정을 찾을 수 없습니다."
$ConnectionAssetName = "AzureClassicRunAsConnection"
# Get the connection
$connection = Get-AutomationConnection -Name $connectionAssetName
# Authenticate to Azure with certificate
Write-Verbose "Get connection asset: $ConnectionAssetName" -Verbose
$Conn = Get-AutomationConnection -Name $ConnectionAssetName
if ($Conn -eq $null)
{
throw "Could not retrieve connection asset: $ConnectionAssetName. Assure that this asset exists in the Automation account."
}
$CertificateAssetName = $Conn.CertificateAssetName
Write-Verbose "Getting the certificate: $CertificateAssetName" -Verbose
$AzureCert = Get-AutomationCertificate -Name $CertificateAssetName
if ($AzureCert -eq $null)
{
throw "Could not retrieve certificate asset: $CertificateAssetName. Assure that this asset exists in the Automation account."
}
Write-Verbose "Authenticating to Azure with certificate." -Verbose
Set-AzureSubscription -SubscriptionName $Conn.SubscriptionName - SubscriptionId $Conn.SubscriptionID -Certificate $AzureCert
Select-AzureSubscription -SubscriptionId $Conn.SubscriptionID
$job = (Get-AzureAutomationJob –AutomationAccountName "THE NAME OF THE AUTOMATION ACCOUNT AS IT APPEARS IN THE PORTAL" –Name "JobStatusTest" | sort LastModifiedDate –desc)[0]
고마워요. 나는 그것을 시도했다. 그러나 나는 같은 오류를 얻는다. "Get-AzureRmAutomationJob : 자동화 계정을 찾을 수 없습니다." – SturmUndDrang
글쎄, 철자법을 확인해야합니다. 또한 -ResourceGroup 스위치 및 resourcegroup 스위치를 지정하려고합니다. – 4c74356b41