共用方式為


使用 Azure Resource Manager (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