我当前正在尝试将Azure的更新管理解决方案设置为已设置的资源组。我已经阅读了很多有关此问题的文档,包括Microsoft的文档:
https://docs.microsoft.com/en-us/azure/automation/automation-update-management

使用GUI进行设置非常简单,但是我一直未能找到以编程方式部署此方法的方法。我想联系堆栈社区,看看是否有人能够部署使用带有代码库的更新管理的环境,或者是否有人找到/构建了可用于在特定VM上启用更新管理器的powershell模块。

最佳答案

这条手臂模板应该可以工作:

{
    "apiVersion": "2017-05-15-preview",
    "type": "Microsoft.Automation/automationAccounts/softwareUpdateConfigurations",
    "name": "automationName/softwareUpdateName",
    "location": "[resourceGroup().location]",
    "properties": {
        "updateConfiguration": {
            "operatingSystem": "Windows",
            "duration": "PT2H0M",
            "windows": {
                "excludedKbNumbers": [
                    "168934",
                    "168973"
                ],
                "includedUpdateClassifications": "Critical",
                "rebootSetting": "IfRequired"
            },
            "azureVirtualMachines": [
                "/subscriptions/5ae68d89-69a4-454f-b5ce-e443cc4e0067/resourceGroups/myresources/providers/Microsoft.Compute/virtualMachines/vm-01",
                "/subscriptions/5ae68d89-69a4-454f-b5ce-e443cc4e0067/resourceGroups/myresources/providers/Microsoft.Compute/virtualMachines/vm-02",
                "/subscriptions/5ae68d89-69a4-454f-b5ce-e443cc4e0067/resourceGroups/myresources/providers/Microsoft.Compute/virtualMachines/vm-03"
            ],
            "nonAzureComputerNames": [
                "box1.contoso.com",
                "box2.contoso.com"
            ]
        },
        "scheduleInfo": {
            "frequency": "Hour",
            "startTime": "2017-10-19T12:22:57+00:00",
            "timeZone": "America/Los_Angeles",
            "interval": 1,
            "expiryTime": "2018-11-09T11:22:57+00:00",
            "advancedSchedule": {
                "weekDays": [
                    "Monday",
                    "Thursday"
                ]
            }
        }
    }
}

您可以使用rest api找出如何以所需方式构造properties

例如,您可以将带有invoke-webrequest的properties json用作有效负载,或者使用curl。

09-04 05:07