用于在Azure虚拟机上启用更新管理的ARM模板

时间:2019-05-07 08:23:25

标签: azure templates virtual-machine azure-resource-manager arm-template

有人可以帮助我使用Azure资源管理器模板在Azure VM上启用更新管理。

我可以在线找到任何模板来启用它。

参考:https://docs.microsoft.com/en-us/azure/automation/automation-update-management

2 个答案:

答案 0 :(得分:0)

您无法启用vm进行更新管理,可以将oms和Azure自动连接到启用了更新管理的位置。或多或少。这或多或少是一个可行的变体:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.1",
    "parameters": {
        "prefix": {
            "type": "string"
        }
    },
    "variables": {
        "namespace": "[concat(parameters('prefix'), '-la')]",
        "automation": "[concat(parameters('prefix'), '-aa')]",
        "solutions": [
            "AlertManagement",
            "Updates",
            "Security"
        ]
    },
    "resources": [
        {
            "type": "Microsoft.OperationalInsights/workspaces",
            "name": "[variables('namespace')]",
            "apiVersion": "2017-03-15-preview",
            "location": "[resourceGroup().location]",
            "properties": {
                "sku": {
                    "name": "Standalone"
                }
            },
            "resources": [
                {
                    "name": "Automation",
                    "type": "linkedServices",
                    "apiVersion": "2015-11-01-preview",
                    "dependsOn": [
                        "[variables('automation')]",
                        "[variables('namespace')]"
                    ],
                    "properties": {
                        "resourceId": "[resourceId('Microsoft.Automation/automationAccounts/', variables('automation'))]"
                    }
                },
            ]
        },
        {
            "type": "Microsoft.Automation/automationAccounts",
            "name": "[variables('automation')]",
            "apiVersion": "2015-10-31",
            "location": "[resourceGroup().location]",
            "properties": {
                "sku": {
                    "name": "OMS"
                }
            }
        },
        {
            "type": "Microsoft.OperationsManagement/solutions",
            "name": "[concat(variables('solutions')[copyIndex()],'(', variables('namespace'), ')')]",
            "apiVersion": "2015-11-01-preview",
            "location": "[resourceGroup().location]",
            "copy": {
                "name": "solutions",
                "count": "[length(variables('solutions'))]"
            },
            "plan": {
                "name": "[concat(variables('solutions')[copyIndex()], '(', variables('namespace'), ')')]",
                "promotionCode": "",
                "product": "[concat('OMSGallery/', variables('solutions')[copyIndex()])]",
                "publisher": "Microsoft"
            },
            "properties": {
                "workspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('namespace'))]"
            },
            "dependsOn": [
                "[variables('namespace')]"
            ]
        }
    ]
}

答案 1 :(得分:0)

我刚刚将以下脚本包含在我的VM部署脚本中。可以

{
        "type": "Microsoft.OperationsManagement/solutions",
        "name": "[concat(variables('solutions')[copyIndex()],'(', parameters('workspaceName'), ')')]",
        "apiVersion": "2015-11-01-preview",
        "location": "[resourceGroup().location]",
        "copy": {
            "name": "solutions",
            "count": "[length(variables('solutions'))]"
        },
        "plan": {
            "name": "[concat(variables('solutions')[copyIndex()], '(', parameters('workspaceName'), ')')]",
            "promotionCode": "",
            "product": "[concat('OMSGallery/', variables('solutions')[copyIndex()])]",
            "publisher": "Microsoft"
        },
        "properties": {
            "workspaceResourceId": "[reference(resourceId(parameters('workspaceRGName'), 'Microsoft.OperationalInsights/workspaces/', parameters('workspaceName')), '2015-03-20').customerId]"
        }
    }