Restart-AzHost
Restart the dedicated host.
Syntax
DefaultParameterSet (Default)
Restart-AzHost
[-ResourceGroupName] <String>
[-HostGroupName] <String>
[-Name] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ResourceIdParameterSet
Restart-AzHost
-ResourceId <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ObjectParameterSet
Restart-AzHost
-InputObject <PSHost>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Examples
Example 1
$Location = 'Location';
$ResourceGroupName = New-AzResourceGroup -Name $rgname -Location $Location -Force;
$hostGroupName = $ResourceGroupName + 'hostgroup'
New-AzHostGroup -ResourceGroupName $ResourceGroupName -Name $hostGroupName -Location $Location -PlatformFaultDomain 1 -Zone "2" -Tag @{key1 = "val1"};
$hostGroup = Get-AzHostGroup -ResourceGroupName $ResourceGroupName -Name $hostGroupName;
$hostName = $ResourceGroupName + 'host';
New-AzHost -ResourceGroupName $ResourceGroupName -HostGroupName $hostGroupName -Name $hostName -Location $Location -Sku "ESv3-Type1" -Tag @{key1 = "val2"};
$dedicatedHost = Get-AzHost -ResourceGroupName $ResourceGroupName -HostGroupName $hostGroupName -Name $hostName;
Restart-AzHost -ResourceGroupName $ResourceGroupName -HostGroupName $hostGroupName -Name $hostName;
# Check the status of the restart operation
$hostRestart = Get-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName -InstanceView;
$hostRestart.InstanceView.Statuses[1].DisplayStatus;
This example creates a dedicated host group and a dedicated host. Then it begins restarting the dedicated host, and checks the status of this restart operation.
You can query the status of the restart operation with the Get-AzHost
cmdlet using the -InstanceView
parameter.
Parameters
-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
-HostGroupName
The name of the dedicated host group.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
DefaultParameterSet
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
The dedicated host object.
Type: PSHost
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Host
ObjectParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
The name of the dedicated host.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: HostName
Parameter sets
DefaultParameterSet
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
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
DefaultParameterSet
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ResourceId
The ARM resource id of the dedicated host.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ResourceIdParameterSet
Position: Named
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