你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Azure Automation State Configuration 概述

注意

在启用 Automation State Configuration 之前,我们希望你知道 DSC 的较新版本目前已正式发布,由名为来宾配置的 Azure Policy 功能管理。 来宾配置服务结合了 DSC 扩展、Azure Automation State Configuration 以及客户反馈中最常请求的功能。 来宾配置还包括通过启用了 Arc 的服务器提供的混合计算机支持。

Azure Automation State Configuration 是一种 Azure 配置管理服务,允许为任何云或本地数据中心内的节点编写、管理和编译 PowerShell 所需状态配置 (DSC) 配置。 该服务还导入 DSC 资源,并将配置分配给目标节点,一切操作均在云中完成。 可以通过选择“配置管理”下的“状态配置 (DSC)”在 Azure 门户中访问 Azure Automation State Configuration 。

可以使用 Azure Automation State Configuration 管理各种不同的计算机:

  • Azure 虚拟机
  • Azure 虚拟机(经典)
  • 位于本地或 Azure以外的云中的物理/虚拟 Windows 计算机(包括 AWS EC2 实例)
  • 位于本地、Azure 或 Azure 以外的云中的物理/虚拟 Linux 计算机

如果未准备好从云中管理计算机配置,也可使用 Azure Automation State Configuration 作为仅限报告的终结点。 此功能允许你通过 DSC 设置(推送)配置,并在 Azure 自动化中查看报表详细信息。

注意

如果已安装的 Azure VM Desired State Configuration 扩展版本大于 2.70,则其中包含了可通过 Azure Automation State Configuration 来管理 Azure VM 的功能,且不收取额外费用。 有关详细信息,请参阅 Automation 定价页

为何使用 Azure Automation State Configuration

与在 Azure 之外使用 DSC 相比,Azure Automation State Configuration 具有多项优势。 该服务可让你从中心的安全位置快速轻松地扩展到数千台计算机。 可以轻松启用计算机、为其分配声明性配置并查看显示每台计算机是否符合指定的所需状态的报告。

Azure Automation State Configuration 服务对于 DSC 而言如同 Azure 自动化 Runbook 对于 PowerShell 脚本而言。 换句话说,Azure 自动化以帮助你管理 PowerShell 脚本的相同方式帮助你管理 DSC 配置。

内置拉取服务器

Azure Automation State Configuration 提供类似于 Windows 功能 DSC 服务的 DSC 拉取服务器。 目标节点可自动接收配置、符合所需状态,以及报告其合规性。 Azure 自动化中的内置拉取服务器消除了设置和维护你自己的拉取服务器的需要。 Azure 自动化的目标可以是云中或本地的虚拟机,或物理 Windows 或 Linux 计算机。

管理所有 DSC 项目

Azure Automation State Configuration 向 PowerShell Desired State Configuration 提供的管理层与它为 PowerShell 脚本提供的相同。 从 Azure 门户,或从 PowerShell,你可以管理所有的 DSC 配置、资源和目标节点。

“Azure 自动化”页的屏幕截图

将报表数据导入 Azure Monitor 日志

使用 Azure Automation State Configuration 进行管理的节点将详细的报表状态数据发送到内置拉取服务器。 可以将 Azure Automation State Configuration 配置为将此数据发送到 Log Analytics 工作区。 请参阅将 Azure Automation State Configuration 报告数据转发到 Azure Monitor 日志

先决条件

使用 Azure Automation State Configuration 时,请想一想本节中的要求。

操作系统要求

对于运行 Windows 的节点,支持以下版本:

  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • Windows Server 2012R2
  • Windows Server 2012
  • Windows Server 2008 R2 SP1
  • Windows 10
  • Windows 8.1
  • Windows 7

注意

Microsoft Hyper-V Server 独立产品 SKU 不包含 DSC 的实现。 因此,它不能由 PowerShell DSC 或 Azure Automation State Configuration 进行管理。

对于运行 Linux 的节点,DSC Linux 扩展支持 PowerShell DSC 文档中列出的所有 Linux 发行版。

DSC 要求

对于在 Azure 中运行的所有 Windows 节点,在启用计算机时会安装 WMF 5.1。 对于运行 Windows 服务器 2012 和 Windows 7 的节点,会启用 WinRM

对于在 Azure 中运行的所有 Linux 节点,将在启用计算机时安装 PowerShell DSC for Linux

私有网络配置

查看 Azure 自动化网络配置,以详细了解专用网络上节点所需的端口、URL 和其他网络详细信息。

代理支持

Windows 版本 1809 及更高版本中提供了对 DSC 代理的代理支持。 此选项的启用方法是:在用于注册节点的元配置脚本中设置 ProxyURLProxyCredential 属性的值。

注意

Azure Automation State Configuration 不为早期版本的 Windows 提供 DSC 代理支持。

对于 Linux 节点,DSC 代理支持代理并使用 http_proxy 变量来确定 URL。 若要详细了解代理支持,请参阅生成 DSC 元配置

每个区域的 DNS 记录数

建议在定义异常时使用每个区域的 DNS 记录数表中列出的地址。

后续步骤