2014-10-31 128 views
0

我試圖反惡意軟件擴展添加到虛擬機的保護,但是當我嘗試在Azure的門戶網站,我收到以下錯誤添加擴展:蔚藍未能擴展添加到虛擬機

無法添加擴展到虛擬機。虛擬機請求無效指定的源圖像是用戶圖像。圖片必須是平臺圖片。

我已經安裝了VMAgent。我已經使用PowerShell試圖

由於額外的信息通過命令使用下面的命令,並得到相應的迴應安裝擴展:

$ VM = GET-AzureVM -ServiceName「服務名」雜牌「MyVMName」

VERBOSE:... - 完成操作:獲取部署*

設置-AzureVMExtension -Publisher Microsoft.Azure.Security -ExtensionName IaaSAntimalware -Version 1 * -VM $ vm.VM

警告:資源擴展參考列表爲空或空

AvailabilitySetName: ConfigurationSets:{} Microsoft.WindowsAzure.Commands.ServiceManagement.Model.NetworkConfigurationSet DataVirtualHardDisks:{ 「MyVMName」} 標籤: OSVirtualHardDisk :Microsoft.WindowsAzure.Commands.ServiceManagement.Model.OSVirtualHardDisk 角色名: 「MyVMName」 RoleSize:大 角色類型:PersistentVMRole WinRMCertificate: X509Certificates : NoExportPrivateKey:假 NoRDPEndpoint:假 NoSSHEndpoint:假 DefaultWinRmCertificateThumbprint:F4CF28C735C5E557C7B47742E4F16A08959272F1 ProvisionGuestAgent: ResourceExtensionReferences:{} IaaSAntimalware DataVirtualHardDisksToBeDeleted:

更新-AzureVM -Name 「服務名」 -ServiceName 「MyVMName」 -VM $ vm.VM

VERBOSE:11:15:10 - 已完成操作:獲得部署 VERBOSE:11:15:10 - 開始操作:U pdate-AzureVM VERBOSE:11:15:42 - 完成操作:Update-AzureVM

OperationDescription OperationId OperationStatus -------------------- ---- ------- --------------- Update-AzureVM 387b77a2-c8fc-233a-913d -cd364c855429成功

當我運行命令我檢查和VMAgent是安裝在虛擬機上但沒有擴展。

有沒有人有任何想法?

謝謝!

回答

0

根據我的經驗,此警告是由於Azure Guest Agent未部署在VM上,未在VM上運行或過期。如果虛擬機沒有健康(當前)的訪客代理,您將無法部署擴展。

您可以檢查與來賓代理狀態:

$vm.GuestAgentStatus 

你會尋找的「準備」,「狀態」;其他任何和擴展可能會失敗。擴展Klaad的代碼,然後...

# Azure Cloud Service and Azure VM Name 
$service= Read-Host -Prompt 'Azure Cloud Service:' 
$name = Read-Host -Prompt 'Azure VM:' 

# Get the Cloud Service and Azure VM 
$vm = Get-AzureVM –ServiceName $service –Name $name 

# Check for health of the agent 
If ($vm.GuestAgentStatus.Status -ne "Ready") { 
    Write-Error "The VM agent appears to not be installed or is in an unhealthy state." 
} 
Else { 
    # Add Microsoft Antimalware Agent to the Azure VM 
    Set-AzureVMExtension -Publisher Microsoft.Azure.Security -ExtensionName IaaSAntimalware -Version 1.* -VM $vm.VM 

    # Update the Azure VM and install the Antimalware Agent 
    Update-AzureVM -Name $name -ServiceName $service -VM $vm.VM 
} 

要檢查代理是存在的,你可以看看在服務器上的以下三個過程:

WaAppAgent.exe 
WindowsAzureGuestAgent.exe 
WindowsAzureTelemetryService.exe 

您可以從here下載代理(電流編輯時的版本是2.6.1198.718)。

安裝需要兩個步驟(來源:Zach Millis):

  1. 安裝代理。這要求您以管理員身份運行PowerShell,並從PowerShell提示符內執行安裝程序。 (不要直接運行)
  2. 更新Azure以便了解代理。這需要執行以下代碼:

代碼:

# Azure Cloud Service and Azure VM Name 
$service= Read-Host -Prompt 'Azure Cloud Service:' 
$name = Read-Host -Prompt 'Azure VM:' 

# Get the Cloud Service and Azure VM 
$vm = Get-AzureVM –ServiceName $service –Name $name 

# Provision the guest agent so Azure knows about it 
$vm.VM.ProvisionGuestAgent = $TRUE 

# Update the Azure VM and install the Antimalware Agent 
$vm | Update-AzureVM 

# Refresh the connection to the VM to get the new status 
$vm = Get-AzureVM –ServiceName $service –Name $name 

# Check status - should now be "Ready" 
$vm.GuestAgentStatus 

這應該是它。