Runbook에서 사용할 때 'Start-AzVM'명령을 찾을 수 없습니다.
Nov 22 2020
나는이 작업입니다 MS 푸른 팀의 공식 튜토리얼 A가 실행 PowerShell Workflow runbook
을 시작합니다 VM
. 하지만 다음 런북을 시작하면 (자습서의 6 단계에서) 아래와 같은 오류가 발생합니다. 질문 : 내가 누락 된 것이 무엇이며 어떻게 문제를 해결할 수 있습니까?
rinbook 코드 :
workflow MyFirstRunbook-Workflow
{
# Ensures that you do not inherit an AzContext in your runbook
Disable-AzContextAutosave –Scope Process
$Conn = Get-AutomationConnection -Name AzureRunAsConnection Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
$AzureContext = Get-AzSubscription -SubscriptionId $Conn.SubscriptionID
Start-AzVM -Name 'vm-cs-web01' -ResourceGroupName 'rg-cs-ansible1' -AzContext $AzureContext
}
오류 :
Failed At line:11 char:1
+ Start-AzVM -Name 'vm-cs-web01' -ResourceGroupName 'rg-cs-ansible1' -A ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cannot find the 'Start-AzVM' 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 { Start-AzVM }'
답변
1 RoadRunner Nov 22 2020 at 11:52
Start-AzVM으로부터입니다 Az.Compute당신이 당신의 자동화 계정에이 모듈을 가져올 필요하므로, 모듈.
이 모듈을 가져 오려면 Automation 계정-> 모듈-> 갤러리 찾아보기-> Az.Compute 검색-> 가져 오기로 이동합니다.
모든 Az.*
모듈을 가져 오려면 Az갤러리 에서 모듈을 가져 오면 됩니다. 이를 자동화 계정으로 가져 오려면 Automation 계정-> 모듈-> 갤러리 찾아보기-> 검색 Az-> 가져 오기로 이동하십시오 .