Azure Cli for software-update-configuration

Senthilnath TM 241 Reputation points
2023-03-09T06:58:45.5433333+00:00

I am automating the Update management via Azure CLI using the command "az automation software-update-configuration create".

When trying to included-update-classifications "Critical, Security", there is always error thrown as mentioned below. What changes to the command can fix them?

Error1:

az automation software-update-configuration create: 'Critical, Security' is not a valid value for '--included-update-classifications'. Allowed values: Unclassified, Critical, Security, UpdateRollup, FeaturePack, ServicePack, Definition, Tools, Updates.

Error2:

Code: BadRequest

Message: {"Message":"The request is invalid.","ModelState":{"softwareUpdateConfiguration.properties.updateConfiguration":["Software update configuration should specify Classification or IncludedPackageNameMask for any reboot setting other than 'RebootOnly'."]}}

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,113 questions
Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
219 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 17,401 Reputation points
    2023-03-17T07:49:29.36+00:00

    @Senthilnath TM Thanks for reporting this. This is known issue and feedback has been conveyed to product team. For now, I would suggest you use PowerShell command to create software update configuration.

    Adding example from Microsoft docs for reference.

    $startTime = [DateTimeOffset]"2023-03-13T21:00"
    $targetMachines = @(
        "/subscriptions/22e2445a-0984-4fa5-86a4-0280d76c4b2c/resourceGroups/compute/providers/Microsoft.Compute/virtualMachines/vm-w-01",
        "/subscriptions/22e2445a-0984-4fa5-86a4-0280d76c4b2c/resourceGroups/compute/providers/Microsoft.Compute/virtualMachines/vm-w-02"
    )
    $duration = New-TimeSpan -Hours 2
    $schedule = New-AzAutomationSchedule -ResourceGroupName "mygroup" `
                                                      -AutomationAccountName "myaccount" `
                                                      -Name MyWeeklySchedule `
                                                      -StartTime $startTime `
                                                      -DaysOfWeek Saturday `
                                                      -WeekInterval 1 `
                                                      -ForUpdateConfiguration
    
    New-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName "mygroup" `
                                                     -AutomationAccountName "myaccount" `
                                                     -Schedule $schedule `
                                                     -Windows `
                                                     -AzureVMResourceId $targetMachines `
                                                     -IncludedUpdateClassification Critical `
                                                     -Duration $duration
    
    UpdateConfiguration   : Microsoft.Azure.Commands.Automation.Model.UpdateManagement.UpdateConfiguration
    ScheduleConfiguration : Microsoft.Azure.Commands.Automation.Model.Schedule
    ProvisioningState     : Provisioning
    ErrorInfo             :
    ResourceGroupName     : mygroup
    AutomationAccountName : myaccount
    Name                  : MyWeeklySchedule
    CreationTime          : 9/14/2018 3:53:27 AM +00:00
    LastModifiedTime      : 9/14/2018 3:53:27 AM +00:00
    Description           :