您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

将更新和更改跟踪解决方案加入 Azure 自动化Onboard update and change tracking solutions to Azure Automation

本教程介绍如何自动将 VM 的更新、更改跟踪和清单解决方案加入 Azure 自动化:In this tutorial, you learn how to automatically onboard Update, Change Tracking, and Inventory solutions for VMs to Azure Automation:

  • 载入 Azure VMOnboard an Azure VM
  • 启用解决方案Enable solutions
  • 安装和更新模块Install and update modules
  • 导入载入 RunbookImport the onboarding runbook
  • 启动 RunbookStart the runbook

先决条件Prerequisites

完成本教程需要以下各项:To complete this tutorial, the following are required:

载入 Azure VMOnboard an Azure VM

可以通过多种方式来载入计算机,可以通过虚拟机通过浏览多个计算机通过自动化帐户或通过 Runbook 载入解决方案。There are multiple ways to onboard machines, you can onboard the solution from a virtual machine, from browsing multiple machines from your Automation account, or by runbook. 本教程详细介绍了如何通过 Runbook 启用更新管理。This tutorial walks through enabling Update Management through a runbook. 若要大规模载入 Azure 虚拟机,须使用更改跟踪或更新管理解决方案载入现有 VM。To onboard Azure Virtual Machines at scale, an existing VM must be onboarded with the Change tracking or Update management solution. 在此步骤中,使用更新管理和更改跟踪载入虚拟机。In this step, you onboard a virtual machine with Update management, and Change tracking.

启用更改跟踪和清单Enable Change Tracking and Inventory

更改跟踪和清单解决方案提供针对虚拟机的跟踪更改清单功能。The Change Tracking and Inventory solution provides the ability to track changes and inventory on your virtual machines. 在此步骤中,在虚拟机上启用解决方案。In this step, you enable the solution on a virtual machine.

  1. 从左侧菜单中,选择“自动化帐户”,然后在列表中选择自动化帐户。From the left menu, select Automation Accounts, and then select your automation account in the list.
  2. 选择“配置管理”下的“清单”。Select Inventory under CONFIGURATION MANAGEMENT.
  3. 选择现有的或创建新的 Log Analytics 工作区。Select an existing Log Analytics workspace or create new. 单击“启用”按钮。Click the Enable button.

载入更新解决方案

更改跟踪和清单解决方案载入通知完成后,请单击“配置管理”下的“更新管理”。When the change tracking and inventory solution onboarding notification completes, click on Update Management under CONFIGURATION MANAGEMENT.

启用更新管理Enable Update Management

使用更新管理解决方案可以管理 Azure Windows VM 的更新和修补程序。The Update Management solution allows you to manage updates and patches for your Azure Windows VMs. 可评估可用更新的状态、计划所需更新的安装以及查看部署结果,验证更新是否已成功应用到 VM。You can assess the status of available updates, schedule installation of required updates, and review deployment results to verify updates were applied successfully to the VM. 在此步骤中,为 VM 启用解决方案。In this step, you enable the solution for your VM.

  1. 从自动化帐户,选择“更新管理”下的“更新管理”。From your Automation Account, select Update management under UPDATE MANAGEMENT.
  2. 选定的 Log Analytics 工作区即为上一步骤中使用的工作区。The Log analytics workspace selected is the same workspace used in the preceding step. 单击“启用”以载入更新管理解决方案。Click Enable to onboard the Update management solution.

载入更新解决方案

更新管理解决方案安装期间会显示一个蓝色横幅。While the Update management solution is being installed, a blue banner is shown. 启用解决方案后,选择“配置管理”下的“更改跟踪”以转到下一步。When the solution is enabled select Change tracking under CONFIGURATION MANAGEMENT to go to the next step.

选择要管理的 Azure VMSelect Azure VM to be managed

现已启用解决方案,可添加 Azure VM 以载入到这些解决方案中。Now that the solutions are enabled, you can add an Azure VM to onboard to those solutions.

  1. 从自动化帐户中,在“更改跟踪”页上,选择“+ 添加 Azure VM”以添加虚拟机。From your Automation Account, on the Change tracking page, select + Add Azure VM to add your virtual machine.

  2. 从列表中选择 VM,然后选择“启用”。Select your VM from the list and select Enable. 此操作为虚拟机启用更改跟踪和清单解决方案。This action enables the Change tacking and Inventory solution for the virtual machine.

    为虚拟机启用更新解决方案

  3. VM 载入通知完成后,从自动化帐户,选择“更新管理”下的“更新管理”。When the VM onboarding notification completes, from your Automation Account select Update management under UPDATE MANAGEMENT.

  4. 选择“+ 添加 Azure VM”以添加虚拟机。Select + Add Azure VM to add your virtual machine.

  5. 从列表中选择 VM,然后选择“启用”。Select your VM from the list and select Enable. 此操作为虚拟机启用更新管理解决方案。This action enables the Update management solution for the virtual machine.

    为虚拟机启用更新解决方案

备注

如果不等待其他解决方案完成,则在启用下一个解决方案时,你会收到一条消息,说明:此虚拟机或其他虚拟机上正在安装其他解决方案。待该解决方案安装完成后,“启用”按钮处于启用状态,可请求在此虚拟机上安装下一个解决方案。If you do not wait for the other solution to complete, when Enabling the next solution you receive a message stating: Installation of another solution is in progress on this or a different virtual machine. When that installation completes the Enable button is enabled, and you can request installation of the solution on this virtual machine.

安装和更新模块Install and update modules

必须更新到最新的 Azure 模块并导入 AzureRM.OperationalInsights 才能成功完成解决方案的自动载入。It is required to update to the latest Azure modules and import AzureRM.OperationalInsights to successfully automate solution onboarding.

更新 Azure 模块Update Azure Modules

从自动化帐户中,选择“共享资源”下的“模块”。From your Automation Account, select Modules under SHARED RESOURCES. 选择“更新 Azure 模块”以更新到最新版本的 Azure 模块。Select Update Azure Modules to update the Azure modules to the latest version. 在出现的提示上选择“是”,将所有现有 Azure 模块更新到最新版本。Select Yes on the prompt to update all existing Azure modules to the latest version.

更新模块

安装 AzureRM.OperationalInsights 模块Install AzureRM.OperationalInsights module

从“模块”页上,选择“浏览库”以打开模块库。From the Modules page, select Browse gallery to open up the module gallery. 搜索 AzureRM.OperationalInsights 并将此模块导入到自动化帐户。Search for AzureRM.OperationalInsights and import this module into the Automation account.

导入 OperationalInsights 模块

导入载入 RunbookImport the onboarding runbook

  1. 从自动化帐户,选择“流程自动化”下的“Runbook”。From your Automation Account, select on Runbooks under the PROCESS AUTOMATION.

  2. 选择“浏览库”。Select Browse gallery.

  3. 搜索“更新和更改跟踪”,单击 runbook,然后选择“查看源”页上的“导入”。Search for update and change tracking, click the runbook and select Import on the View Source page. 选择“确定”,将 runbook 导入自动化帐户。Select OK to import the runbook into the Automation account.

    导入载入 Runbook

  4. 在“Runbook”页上,选择“编辑”,然后选择“发布”。On the Runbook page, select Edit, then select Publish. 在“发布 Runbook”对话框中,选择“是”以发布 runbook。On the Publish Runbook dialog, select Yes to publish the runbook.

启动 RunbookStart the runbook

若要启动此 Runbook,必须事先将更改跟踪或更新解决方案加入 Azure VM。You must have onboarded either change tracking or update solutions to an Azure VM in order to start this runbook. 此 Runbook 需要使用已加入解决方案的现有虚拟机和资源组作为参数。It requires an existing virtual machine and resource group with the solution onboarded for parameters.

  1. 打开 Enable-MultipleSolution Runbook。Open the Enable-MultipleSolution runbook.

    多个解决方案 Runbook

  2. 单击“启动”按钮并输入以下参数值。Click the start button and enter the following values for parameters.

    • 数据库 - 保留空白。VMNAME - Leave blank. 已加入更新或更改跟踪解决方案的现有 VM 的名称。The name of an existing VM to onboard to update or change tracking solution. 通过将此值留空,可载入资源组中的所有 VM。By leaving this value blank, all VMs in the resource group are onboarded.
    • VMRESOURCEGROUP - 要载入的 VM 的资源组的名称。VMRESOURCEGROUP - The name of the resource group for the VMs to be onboarded.
    • SUBSCRIPTIONID -保留为空。SUBSCRIPTIONID - Leave blank. 要加入的新 VM 的订阅 ID。The subscription ID of the new VM to be onboarded. 如果留空,将使用工作区的订阅。If left blank, the subscription of the workspace is used. 如果指定不同的订阅 ID,则还应该添加此自动化帐户的运行方式帐户作为此订阅的参与者。When a different subscription ID is given, the RunAs account for this automation account should be added as a contributor for this subscription also.
    • ALREADYONBOARDEDVM - 已手动加入更新或更改跟踪解决方案的 VM 的名称。ALREADYONBOARDEDVM - The name of the VM that was manually onboarded to either the Updates or ChangeTracking solution.
    • ALREADYONBOARDEDVMRESOURCEGROUP - VM 所属的资源组的名称。ALREADYONBOARDEDVMRESOURCEGROUP - The name of the resource group that the VM is a member of.
    • SOLUTIONTYPE - 输入“更新”或“更改跟踪”SOLUTIONTYPE - Enter Updates or ChangeTracking

    Enable-MultipleSolution Runbook 参数

  3. 选择“确定”启动 Runbook 作业。Select OK to start the runbook job.

  4. 在 Runbook 的“作业”页上监视进度和任何错误。Monitor progress and any errors on the runbook job page.

后续步骤Next steps

本教程介绍了如何:In this tutorial, you learned how to:

  • 手动加入 Azure 虚拟机。Onboard an Azure virtual machine manually.
  • 安装和更新所需的 Azure 模块。Install and update required Azure modules.
  • 导入用于加入 Azure VM 的 Runbook。Import a runbook that onboards Azure VMs.
  • 启动用于自动加入 Azure VM 的 Runbook。Start the runbook that onboards Azure VMs automatically.

请单击以下链接了解有关计划 runbook 的详细信息。Follow this link to learn more about scheduling runbooks.