共用方式為


使用 Azure Resource Manager (ARM) 範本將機器上線至 Automanage

警告

Azure Automanage 最佳做法服務將於 2027 年 9 月 30 日淘汰。 因此,嘗試建立新的組態配置檔或將新的訂用帳戶上線至服務將會導致錯誤。 在這裡深入瞭解如何移轉至該日期之前的 Azure 原則。

警告

從 2025 年 2 月 1 日起,Azure Automanage 將會開始推出變更,以停止所有相依於已取代Microsoft監視代理程式 (MMA) 的服務支援和強制執行。 若要繼續使用 變更追蹤 和管理、VM Insights、更新管理和 Azure 自動化,請移轉至新的 Azure 監視器代理程式 (AMA)。

概觀

遵循步驟,以使用 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