Restart-AzHost

Restart the dedicated host.

Syntax

Restart-AzHost
       [-ResourceGroupName] <String>
       [-HostGroupName] <String>
       [-Name] <String>
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restart-AzHost
       -ResourceId <String>
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restart-AzHost
       -InputObject <PSHost>
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

Restart the dedicated host. The operation will complete successfully once the dedicated host has restarted and is running. To determine the health of VMs deployed on the dedicated host after the restart check the Resource Health Center in the Azure Portal. Please refer to https://zcusa.951200.xyz/en-us/azure/service-health/resource-health-overview for more details.

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.

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

-HostGroupName

The name of the dedicated host group.

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

-InputObject

The dedicated host object.

Type:PSHost
Aliases:Host
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of the dedicated host.

Type:String
Aliases:HostName
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

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

-ResourceId

The ARM resource id of the dedicated host.

Type:String
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

Inputs

String

PSHost

Outputs

PSOperationStatusResponse