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

使用 Azure 资源管理器 (ARM) 模板将计算机加入 Automanage

概述

按照下面的步骤,使用 ARM 模板将计算机加入 Automanage 最佳做法。

先决条件

ARM 模板概述

下面的 ARM 模板会将指定的计算机加入 Azure Automanage 最佳做法。 请参阅 ARM 模板部署部分,详细了解 ARM 模板及其部署步骤。

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "machineName": {
            "type": "String"
        },
        "configurationProfileName": {
            "type": "String"
        }
    },
    "resources": [
        {
            "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments",
            "apiVersion": "2022-05-04",
            "name": "[concat(parameters('machineName'), '/Microsoft.Automanage/default')]",
            "properties": {
                "configurationProfile": "[parameters('configurationProfileName')]"
            }
        }
    ]
}

ARM 模板部署

此 ARM 模板将为指定计算机创建一个配置文件分配。

configurationProfile 值可以是以下值之一:

  • “/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction”
  • “/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest”
  • "/subscriptions/[sub ID]/resourceGroups/resourceGroupName/providers/Microsoft.Automanage/configurationProfiles/customProfileName(对于自定义配置文件)

请遵照以下步骤部署 ARM 模板:

  1. 将此 ARM 模板另存为 azuredeploy.json
  2. 使用 az deployment group create --resource-group myResourceGroup --template-file azuredeploy.json 运行此 ARM 模板部署
  3. 当系统发出提示时,提供 machineName 和 configurationProfileName 的值
  4. 可以开始部署了

与任何 ARM 模板一样,可以将参数分解成单独的 azuredeploy.parameters.json 文件,然后在进行部署时将该文件用作参数。

后续步骤

详细了解用于 LinuxWindows 的 Automanage