New-AzAutomationSoftwareUpdateConfiguration

Creates a scheduled azure automation software update configuration.

Syntax

New-AzAutomationSoftwareUpdateConfiguration
   -Schedule <Schedule>
   [-Windows]
   [-RebootOnly]
   [-AzureVMResourceId <String[]>]
   [-PreTaskRunbookName <String>]
   [-PostTaskRunbookName <String>]
   [-PreTaskRunbookParameter <Hashtable>]
   [-PostTaskRunbookParameter <Hashtable>]
   [-NonAzureComputer <String[]>]
   [-AzureQuery <AzureQueryProperties[]>]
   [-NonAzureQuery <NonAzureQueryProperties[]>]
   [-Duration <TimeSpan>]
   [-RebootSetting <RebootSetting>]
   [-IncludedUpdateClassification <WindowsUpdateClasses[]>]
   [-ExcludedKbNumber <String[]>]
   [-IncludedKbNumber <String[]>]
   [-ResourceGroupName] <String>
   [-AutomationAccountName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzAutomationSoftwareUpdateConfiguration
   -Schedule <Schedule>
   [-Linux]
   [-RebootOnly]
   [-AzureVMResourceId <String[]>]
   [-PreTaskRunbookName <String>]
   [-PostTaskRunbookName <String>]
   [-PreTaskRunbookParameter <Hashtable>]
   [-PostTaskRunbookParameter <Hashtable>]
   [-NonAzureComputer <String[]>]
   [-AzureQuery <AzureQueryProperties[]>]
   [-NonAzureQuery <NonAzureQueryProperties[]>]
   [-Duration <TimeSpan>]
   [-RebootSetting <RebootSetting>]
   [-IncludedPackageClassification <LinuxPackageClasses[]>]
   [-ExcludedPackageNameMask <String[]>]
   [-IncludedPackageNameMask <String[]>]
   [-ResourceGroupName] <String>
   [-AutomationAccountName] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Creates a software update configuration that runs on a schedule to update a list of computers. Computers include both azure virtual machines or non-az computers.

Examples

Example 1

Creates a software update configuration to install critical updates on two Windows azure virtual machines once every Saturday 9PM. Update duration is set to 2 hours in this example.

$startTime = [DateTimeOffset]"2018-09-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           :

Parameters

-AutomationAccountName

The automation account name.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-AzureQuery

Dynamic group azure query.

Type:AzureQueryProperties[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-AzureVMResourceId

Resource Ids for azure virtual machines.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Duration

Maximum duration for the update.

Type:TimeSpan
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ExcludedKbNumber

KB numbers of excluded updates.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ExcludedPackageNameMask

Excluded Linux package masks.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IncludedKbNumber

KB numbers of included updates.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IncludedPackageClassification

Included Linux package classifications.

Type:LinuxPackageClasses[]
Accepted values:Unclassified, Critical, Security, Other
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IncludedPackageNameMask

Included Linux package masks.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-IncludedUpdateClassification

Included Windows Update classifications.

Type:WindowsUpdateClasses[]
Accepted values:Unclassified, Critical, Security, UpdateRollup, FeaturePack, ServicePack, Definition, Tools, Updates
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Linux

Indicates that the software update configuration targeting Linux operating system machines.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-NonAzureComputer

Non-Az computer names.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-NonAzureQuery

Dynamic group non Azure query.

Type:NonAzureQueryProperties[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PostTaskRunbookName

Post task.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PostTaskRunbookParameter

Post task parameter.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PreTaskRunbookName

Pre task.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PreTaskRunbookParameter

Pre task parameter.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RebootOnly

Indicates that the software update configuration will Only Reboot the machines.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RebootSetting

Reboot Setting.

Type:RebootSetting
Accepted values:IfRequired, Never, Always, RebootOnly
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

The resource group name.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Schedule

Schedule object used for software update configuration.

Type:Schedule
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Windows

Indicates that the software update configuration targeting windows operating system machines.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

Schedule

SwitchParameter

String[]

TimeSpan

WindowsUpdateClasses[]

LinuxPackageClasses[]

String

Outputs

SoftwareUpdateConfiguration