azure - 如何以编程方式将更新管理部署到 Azure 资源

标签 azure powershell updates patch

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

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

最佳答案

这 block ARM 模板应该可以工作:

{
    "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"
                ]
            }
        }
    }
}

您可以使用其余 API 来了解如何按照您需要的方式构造属性

您可以使用相同的 properties json 和 invoke-webrequest 作为有效负载,例如,或curl。

关于azure - 如何以编程方式将更新管理部署到 Azure 资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52635285/

相关文章:

powershell - 在 Where-Object 条件之后获取第一个值

.net - Powershell反射查找功能

ajax - 如何以编程方式对Backing bean中的Ajax更新特定组件

Windows Azure 虚拟机,Server 2012,无法激活 0xC004F074

azure - 如何在 Azure 上使用 Table.js 对简单表执行插入操作

azure - Azure B2C 中是否存在自助服务组所有权?

jenkins - 更新 Jenkins 插件的问题

使用企业库在 azure 中记录异常

powershell - 将 -Verbose 状态传递给模块 cmdlet

android - 由于服务应用程序更新,我的应用程序被杀死