Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
New-AzMaintenanceConfiguration
- Module:
- Az.Maintenance Module
Create or Update configuration record
Syntax
Default (Default)
New-AzMaintenanceConfiguration
[-ResourceGroupName] <String>
[-Name] <String>
[-Location] <String>
[-Tag <Hashtable>]
[-ExtensionProperty <Hashtable>]
[-MaintenanceScope <String>]
[-StartDateTime <String>]
[-ExpirationDateTime <String>]
[-Timezone <String>]
[-Duration <TimeSpan>]
[-Visibility <String>]
[-RecurEvery <String>]
[-LinuxParameterPackageNameMaskToInclude <System.Collections.Generic.HashSet`1[System.String]>]
[-LinuxParameterPackageNameMaskToExclude <System.Collections.Generic.HashSet`1[System.String]>]
[-LinuxParameterClassificationToInclude <System.Collections.Generic.HashSet`1[System.String]>]
[-WindowParameterKbNumberToInclude <System.Collections.Generic.HashSet`1[System.String]>]
[-WindowParameterKbNumberToExclude <System.Collections.Generic.HashSet`1[System.String]>]
[-WindowParameterClassificationToInclude <System.Collections.Generic.HashSet`1[System.String]>]
[-WindowParameterExcludeKbRequiringReboot <Boolean>]
[-InstallPatchRebootSetting <String>]
[-PreTask <String>]
[-PostTask <String>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Create or Update configuration record
Examples
Example 1
New-AzMaintenanceConfiguration -ResourceGroupName smdtest -Name workervmscentralus -MaintenanceScope Host -Location centralus -StartDateTime "2020-08-01 00:00" -ExpirationDateTime "2021-08-04 00:00" -Timezone "Pacific Standard Time" -Duration 05:00 -RecurEvery Day
Location : centralus
Tags : {}
ExtensionProperties : {}
MaintenanceScope : Host
StartDateTime : 2020-08-01 00:00
ExpirationDateTime : 2021-08-04 00:00
TimeZone : Pacific Standard Time
RecurEvery : Day
Duration : 05:00
MaintenanceScope : Host
Visibility : Custom
Id : /subscriptions/42c974dd-2c03-4f1b-96ad-b07f050aaa74/resourcegroups/smdtest/providers/Microsoft.Maintenance/maintenanceConfigurations/workervmscentralus
Name : workervmscentralus
Type : Microsoft.Maintenance/maintenanceConfigurations
Create a maintenance configuration with scope Host
Example 2
New-AzMaintenanceConfiguration -ResourceGroupName sample-rg -Name PatchSchedule -MaintenanceScope "InGuestPatch" -Location westeurope -Timezone "UTC" -StartDateTime "2025-10-09 12:30" -Duration "3:00" -RecurEvery "Day" -LinuxParameterClassificationToInclude @('Other') -LinuxParameterPackageNameMaskToInclude @('lib', 'kernel') -LinuxParameterPackageNameMaskToExclude @('curl', 'vim') -WindowParameterClassificationToInclude @('Critical', 'Security') -WindowParameterKbNumberToInclude @('5035849', '5035857') -WindowParameterKbNumberToExclude @('5034439') -ExtensionProperty @{inGuestPatchMode="User"} -InstallPatchRebootSetting "IfRequired" -Debug
Location : westeurope
Tags : {"resource":"test"}
ExtensionProperties : {"inGuestPatchMode":"User"}
MaintenanceScope : InGuestPatch
Id :
/subscriptions/783fd652-64f3-4680-81e9-0b978c542005/resourcegroups/sample-rg/providers/Microsoft.Maintenance/maintenanceConfigurations/PatchSchedule
Name : PatchSchedule
Type : Microsoft.Maintenance/maintenanceConfigurations
StartDateTime : 2025-10-09 12:30
Duration : 03:00
Timezone : UTC
Visibility : Custom
RecurEvery : Day
LinuxParameterClassificationToInclude :
LinuxParameterPackageNameMaskToExclude :
LinuxParameterPackageNameMaskToInclude : apt
httpd
WindowParameterKbNumberToInclude :
WindowParameterKbNumberToExclude :
WindowParameterClassificationToInclude :
InstallPatchRebootSetting : IfRequired
Create a maintenance configuration with scope InGuest
Parameters
-AsJob
Run cmdlet in the background
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-Duration
The duration
Parameter properties
| Type: | TimeSpan |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ExpirationDateTime
The expirationDateTime of the schedule in format YYYY-MM-DD hh:mm
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ExtensionProperty
The Extension properties per resource.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InstallPatchRebootSetting
Install Patch Reboot Option. Allowed values Never, IfRequired, Always
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-LinuxParameterClassificationToInclude
List of linux patch classifications. Allowed values are 'Critical', 'Security', and 'Other'.
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-LinuxParameterPackageNameMaskToExclude
List of packages to exclude during vm patch operation
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-LinuxParameterPackageNameMaskToInclude
List of packages to include during vm patch operation
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Location
The maintenance configuration location.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MaintenanceScope
The Maintenance Scope.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
The maintenance configuration Name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PostTask
List of tasks executed after schedule. [{'source' :'runbook', 'taskScope': 'Resource', 'parameters': { 'arg1': 'value1'}}]. This parameter is used to specify a command or script that should be run after the maintenance tasks are performed. This can be used to perform any necessary follow-up actions after the maintenance tasks are completed. This parameter accepts a string value that specifies the command or script to be run. The command or script can be specified as a simple string or as an array of strings. If an array of strings is specified, each element in the array will be treated as a separate command or script.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PreTask
List of tasks executed before schedule. e.g. [{'source' :'runbook', 'taskScope': 'Global', 'parameters': { 'arg1': 'value1'}}]. This parameter is used to specify a command or script that should be run before the maintenance tasks are performed. This can be used to perform any necessary preparations or cleanup actions before the maintenance tasks are run. This parameter accepts a string value that specifies the command or script to be run. The command or script can be specified as a simple string or as an array of strings. If an array of strings is specified, each element in the array will be treated as a separate command or script.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RecurEvery
The schedule recurrence
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
The resource Group Name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StartDateTime
The StartDateTime of the schedule in format YYYY-MM-DD hh:mm
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Tag
The ARM Tags.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Timezone
The timezone
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Visibility
The visibility of the scope
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
-WindowParameterClassificationToInclude
List of windows patch classification. Allowed values are 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', 'ServicePack', 'Definition', 'Tools', and 'Updates'.
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WindowParameterExcludeKbRequiringReboot
Exclude KBs which require reboot
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WindowParameterKbNumberToExclude
List of KBs to exclude during vm patch operation
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WindowParameterKbNumberToInclude
List of KBs to include during vm patch operation
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
Outputs
PSMaintenanceConfiguration
Azure PowerShell
Feedback
Was this page helpful?
