Azure ARM-更新管理-VM入门

问题描述 投票:0回答:1

我已经为VM进入Update Management准备了模板,这些模板由ARM涵盖:MMA代理安装,将VM连接到工作区。 ARM工作正常,但是部署后还有一项任务要做,我必须在Update Management控制台中手动启用VM。我知道我可以在“管理机器”部分中启用自动启用功能,但是我想控制VM,并决定是否启用哪些VM。我的模板如下所示,有什么方法可以使用ARM模板将VM完全内置到Update Management中?

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "vmName": {
            "type": "string",
            "minLength": 1,
            "metadata": {
                "description": "List of virtual machines to be Lg Analytics Joined joined, if using multiple VMs, make their names comma separate. E.g. VM01, VM02, VM03."
            },
            "defaultValue": "VM1,VM2"
        },
        "Location":{
            "type": "string",
            "metadata": {
                "description": "Location of the VM"
            },
            "defaultvalue": "WestEurope"
        },

        "OMSWorkspaceResourceGroup":{
            "type": "string",
            "metadata": {
                "description": "OMSWorkspace RESOURCE GROUP"
            },
            "defaultvalue": "yourLogAnalyticsRG"
        },
        "omsWorkspacename": {
            "type": "string",
            "metadata": {
                "description": "OMSWorkspaceName"
            },
            "defaultvalue": "YourLoganalyticsworkspacename"
        }
    },
    "variables": {

        "vmListArray": "[split(parameters('vmName'),',')]"
    },
    "resources": [
        {
            "comments": "LogAnalyticsExtention",
            "apiVersion": "2019-07-01",
            "location": "[parameters('Location')]",
            "type": "Microsoft.Compute/virtualMachines/extensions",
            "name": "[concat(trim(variables('vmListArray')[copyIndex()]),'/MicrosoftMonitoringAgent')]",
            "copy": {
                "name": "ExtentionLooptoAllVMs",
                "count": "[length(variables('vmListArray'))]"
            },
            "properties": {
                "publisher": "Microsoft.EnterpriseCloud.Monitoring",
        "type": "MicrosoftMonitoringAgent",
        "typeHandlerVersion": "1.0",
        "autoUpgradeMinorVersion": true,
                "settings": {
                    "workspaceId": "[reference(resourceId(parameters('OMSWorkspaceResourceGroup'), 'Microsoft.OperationalInsights/workspaces/', parameters('omsWorkspacename')), '2015-11-01-preview').customerId]"
                },
                "protectedSettings": {
                    "workspaceKey": "[listKeys(resourceId(parameters('OMSWorkspaceResourceGroup'),'Microsoft.OperationalInsights/workspaces/', parameters('omsWorkspacename')),'2015-11-01-preview').primarySharedKey]"
                }
            }
        }
    ]
}
azure azure-resource-manager azure-powershell azure-automation azure-log-analytics
1个回答
0
投票

This文档的模板具有以下提到的前4个步骤,但总体而言,与您所需要的(在门户中一样)是:]]

  1. 创建Log Analytics工作区。 ARM参考:https://docs.microsoft.com/azure/templates/microsoft.operationalinsights/2015-11-01-preview/workspaces
  2. 创建自动化帐户。 ARM参考:https://docs.microsoft.com/azure/templates/microsoft.automation/2015-10-31/automationaccounts
  3. 链接自动化帐户和Log Analytics工作区。 ARM参考:https://docs.microsoft.com/azure/templates/microsoft.operationalinsights/2015-11-01-preview/workspaces/linkedservices
  4. 安装OMS / LA解决方案,例如更新管理。 ARM参考:https://docs.microsoft.com/azure/templates/microsoft.operationsmanagement/2015-11-01-preview/solutions
  5. 通过VM扩展将机器加载到OMS / LA解决方案。 ARM参考:https://docs.microsoft.com/azure/templates/microsoft.compute/2019-07-01/virtualmachines/extensions还提供VM extension for WindowsVM extension for Linux的样本用法。
  6. 也许我正在丢失某些东西,但是根据您提供的信息,我相信您已经错过了上述第3步和第4步。因此,建议您先完成第3步和第4步,然后再进行第5步。

希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.