Remove-AzVmssLifecycleHook
Removes one or all lifecycle hooks from a Virtual Machine Scale Set (VMSS).
Syntax
ByTypeParameterSet (Default)
Remove-AzVmssLifecycleHook
-ResourceGroupName <String>
-VMScaleSetName <String>
-Type <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
AllParameterSet
Remove-AzVmssLifecycleHook
-ResourceGroupName <String>
-VMScaleSetName <String>
[-All]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Remove-AzVmssLifecycleHook cmdlet removes one lifecycle hook (by -Type) or all lifecycle hooks (-All) from an existing virtual machine scale set (VMSS) by fetching the current VMSS, removing the specified hook(s), and updating the VMSS.
Examples
Example 1: Remove a lifecycle hook by type
Remove-AzVmssLifecycleHook -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Type 'UpgradeAutoOSScheduling'
This example removes the 'UpgradeAutoOSScheduling' lifecycle hook from the specified VMSS.
Example 2: Remove all lifecycle hooks
Remove-AzVmssLifecycleHook -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -All
This example removes all lifecycle hooks from the specified VMSS.
Example 3: Preview removal with WhatIf
Remove-AzVmssLifecycleHook -ResourceGroupName 'myRg' -VMScaleSetName 'myVmss' -Type 'UpgradeAutoOSScheduling' -WhatIf
This example previews what would happen when removing the hook, without making any changes.
Parameters
-All
When specified, removes all lifecycle hooks from the virtual machine scale set.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AllParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
The name of the resource group.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Type
The lifecycle hook type to remove. Possible values: 'UpgradeAutoOSScheduling', 'UpgradeAutoOSRollingBatchStarting'.
Parameter properties
Type: String
Default value: None
Accepted values: UpgradeAutoOSScheduling, UpgradeAutoOSRollingBatchStarting
Supports wildcards: False
DontShow: False
Parameter sets
ByTypeParameterSet
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-VMScaleSetName
The name of the VM scale set.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Name
Parameter sets
(All)
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
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 .
Outputs