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

发现在 Azure 计算机和非 Azure 计算机上安装的软件Discover what software is installed on your Azure and non-Azure machines

本教程介绍如何发现在环境中安装的软件。In this tutorial, you learn how to discover what software is installed in your environment. 可以收集和查看清单,了解计算机上的软件、文件、Linux 守护程序、Windows 服务和 Windows 注册表项。You can collect and view inventory for software, files, Linux daemons, Windows Services, and Windows Registry keys on your computers. 跟踪计算机的配置有助于查明环境中的操作问题,更好地了解计算机的状态。Tracking the configurations of your machines can help you pinpoint operational issues across your environment and better understand the state of your machines.

本教程介绍如何执行下列操作:In this tutorial you learn how to:

  • 启用此解决方案Enable the solution
  • 载入 Azure VMOnboard an Azure VM
  • 载入非 Azure VMOnboard a non-Azure VM
  • 查看已安装软件View installed software
  • 在清单日志中搜索已安装的软件Search inventory logs for installed software

先决条件Prerequisites

要完成本教程,需要:To complete this tutorial, you need:

登录 AzureLog in to Azure

通过 https://portal.azure.com 登录到 Azure 门户。Log in to the Azure portal at https://portal.azure.com.

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

就本教程来说,首先需要启用更改跟踪和清单。First you need to enable Change tracking and Inventory for this tutorial. 如果以前已经启用了更改跟踪解决方案,则此步骤不是必需的。If you've previously enabled the Change Tracking solution, this step is not necessary.

导航到你的自动化帐户,在“配置管理”下选择“清单”。 Navigate to your Automation Account and select Inventory under CONFIGURATION MANAGEMENT.

选择 Log Analytics 工作区和自动化帐户,然后单击“启用”以启用此解决方案。 Choose the Log Analytics workspace and Automation Account and click Enable to enable the solution. 启用此解决方案最长需要 15 分钟的时间。The solution takes up to 15 minutes to enable.

清单载入配置横幅

若要启用此解决方案,请配置要使用的位置、Log Analytics 工作区和自动化帐户,然后单击“启用”。 To enable the solution, configure the location, Log analytics workspace, and Automation Account to use and click Enable. 如果这些字段灰显,则意味着已经为 VM 启用了其他自动化解决方案,因此必须使用同一工作区和自动化帐户。If the fields are grayed out, that means another automation solution is enabled for the VM and the same workspace and Automation Account must be used.

Log Analytics 工作区用于收集由功能和服务(如清单)生成的数据。A Log Analytics workspace is used to collect data that is generated by features and services such as Inventory. 工作区提供了一个位置来查看和分析来自多个数据源的数据。The workspace provides a single location to review and analyze data from multiple sources.

备注

本文最近已更新,从使用术语“Log Analytics”改为使用术语“Azure Monitor 日志”。This article was recently updated to use the term Azure Monitor logs instead of Log Analytics. 日志数据仍然存储在 Log Analytics 工作区中,并仍然由同一 Log Analytics 服务收集并分析。Log data is still stored in a Log Analytics workspace and is still collected and analyzed by the same Log Analytics service. 我们正在更新术语,以便更好地反映 Azure Monitor 中的日志的角色。We are updating the terminology to better reflect the role of logs in Azure Monitor. 有关详细信息,请参阅 Azure Monitor 术语更改See Azure Monitor terminology changes for details.

启用解决方案最多可能需要 15 分钟。Enabling the solution can take up to 15 minutes. 在此期间,不应关闭浏览器窗口。During this time, you shouldn't close the browser window. 启用该解决方案后,VM 中有关已安装软件和更改的信息会流向 Azure Monitor 日志。After the solution is enabled, information about installed software and changes on the VM flows to Azure Monitor logs. 这些数据需花费 30 分钟到 6 小时的时间才能用于分析。It can take between 30 minutes and 6 hours for the data to be available for analysis.

载入 VMOnboard a VM

在你的自动化帐户中,导航到“配置管理”下的“清单”。 In your Automation Account, navigate to Inventory under CONFIGURATION MANAGEMENT.

选择“+ 添加 Azure VM” ,这将打开“虚拟机” 页面并允许从列表中选择现有 VM。Select + Add Azure VM, this opens up the Virtual machines page and allows you to select an existing VM from the list. 选择要载入的 VM。Select the VM you want to onboard. 在打开的页面上,单击“启用”以在 VM 上启用此解决方案。 On the page that opens click Enable to enable the solution on the VM. Microsoft 管理代理部署到 VM,并配置代理来与你在启用解决方案时配置的 Log Analytics 工作区进行通信。The Microsoft Management Agent is deployed to the VM and configures the agent to talk to the Log Analytics workspace you configured when enabling the solution. 可能需要花费几分钟时间才能完成载入。This can take a few minutes to complete the onboarding. 此时,可以从列表中选择一台新的 VM 并载入另一 VM。At this point, you can select a new VM from the list and onboard another VM.

载入非 Azure 计算机Onboard a non-Azure machine

若要添加非 Azure 计算机,请根据你的操作系统安装适用于 WindowsLinux 的代理。To add non-Azure machines, install the agent for Windows or Linux depending on your operating system. 安装代理后,导航到你的自动化帐户,然后转到“配置管理”下的“清单”。 Once the agent is installed, navigate to your Automation Account and go to Inventory under CONFIGURATION MANAGEMENT. 单击“管理计算机” 时,可以看到向你的 Log Analytics 工作区进行报告且尚未启用此解决方案的计算机的列表。When you click Manage Machines, you see a list of the machines reporting to your Log Analytics workspace that do not have the solution enabled. 选择适合你的环境的选项。Select the appropriate option for your environment.

  • 在所有可用计算机上启用 - 此选项在当前向你的 Log Analytics 工作区进行报告的所有计算机上启用此解决方案。Enable on all available machines - This option enables the solution on all the machines reporting to your Log Analytics workspace at this time.
  • 在所有可用计算机以及将来的计算机上启用 - 此选项在向你的 Log Analytics 工作区进行报告的所有计算机上启用此解决方案,并且会在将来添加到该工作区的所有计算机上启用此解决方案。Enable on all available machines and future machines - This option enables the solution on all machines reporting to your Log Analytics workspace and subsequently on all future machines added to the workspace.
  • 在所选计算机上启用 - 此选项仅在你选择的计算机上启用此解决方案。Enable on selected machines - This option enables the solution only on the machines that you have selected.

管理计算机

查看已安装软件View installed software

启用更改跟踪和清单解决方案以后,即可在“清单”页查看结果。 Once the Change tracking and Inventory solution is enabled, you can view the results on the Inventory page.

从你的自动化帐户中,在“配置管理”下选择“清单”。 From within your Automation Account, select Inventory under CONFIGURATION MANAGEMENT.

在“清单”页上单击“软件”选项卡。 On the Inventory page, click on the Software tab.

“软件”选项卡上有一个表,其中列出了已发现的软件。 On the Software tab, there is a table that lists the software that has been found. 软件按软件名称和版本分组。The software is grouped by software name and version.

可在表中查看每个软件记录的高级详细信息。The high-level details for each software record are viewable in the table. 这些详细信息包括:软件名称、版本、发布者、上次刷新时间(由组中的计算机报告的最近刷新时间)、计算机数(装有该软件的计算机的计数)。These details include the software name, version, publisher, last refreshed time (the most recent refresh time reported by a machine in the group), and machines (the count of machines with that software).

软件清单

单击一行即可查看软件记录的属性以及装有该软件的计算机的名称。Click on a row to view the properties of the software record and the names of the machines with that software.

若要查找特定的软件或软件组,可以在软件列表正上方的文本框中搜索。To look for a specific software or group of software, you can search in the text box directly above the software list. 可以使用筛选器根据软件名称、版本或发布者进行搜索。The filter allows you to search based off the software name, version, or publisher.

例如,搜索“Contoso”会返回名称、发布者或版本中包含“Contoso”的所有软件。For instance, searching for "Contoso" returns all software with a name, publisher, or version containing "Contoso".

在清单日志中搜索已安装的软件Search inventory logs for installed software

清单生成发送到 Azure Monitor 日志的日志数据。Inventory generates log data that is sent to Azure Monitor logs. 若要通过运行查询来搜索日志,请选择“清单”窗口顶部的“Log Analytics”。 To search the logs by running queries, select Log Analytics at the top of the Inventory window.

清单数据存储在 ConfigurationData 类型下。Inventory data is stored under the type ConfigurationData. 以下示例 Log Analytics 查询返回 Publisher 等于“Microsoft Corporation”的清单结果。The following sample Log Analytics query returns the inventory results where the Publisher equals "Microsoft Corporation".

ConfigurationData
| where ConfigDataType == "Software"
| where Publisher == "Microsoft Corporation"
| summarize arg_max(TimeGenerated, *) by SoftwareName, Computer

若要详细了解如何在 Azure Monitor 日志中运行和搜索日志文件,请参阅 Azure Monitor 日志To learn more about running and searching log files in Azure Monitor logs, see Azure Monitor logs.

单个计算机的清单Single machine inventory

若要查看单个计算机的软件清单,可以访问 Azure VM 资源页中的“清单”,也可以使用 Azure Monitor 日志筛选出相应的计算机。To see the software inventory for a single machine, you can access Inventory from the Azure VM resource page or use Azure Monitor logs to filter down to the corresponding machine. 以下 Log Analytics 查询示例返回名为 ContosoVM 的计算机的软件列表。The following example Log Analytics query returns the list of software for a machine named ContosoVM.

ConfigurationData
| where ConfigDataType == "Software"
| summarize arg_max(TimeGenerated, *) by SoftwareName, CurrentVersion
| where Computer =="ContosoVM"
| render table
| summarize by Publisher, SoftwareName

后续步骤Next steps

本教程介绍了如何查看软件清单,例如,如何:In this tutorial you learned how view software inventory such as how to:

  • 启用此解决方案Enable the solution
  • 载入 Azure VMOnboard an Azure VM
  • 载入非 Azure VMOnboard a non-Azure VM
  • 查看已安装软件View installed software
  • 在清单日志中搜索已安装的软件Search inventory logs for installed software

继续阅读更改跟踪和清单解决方案的概述可以了解其详细信息。Continue to the overview for the Change tracking and Inventory solution to learn more about it.