スケジュールでランブラを実行したいが、最後のジョブが実行を終了していない場合(つまり、スケジュールが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スイッチとリソースグループスイッチを指定することもできます – 4c74356b41