Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Restart-AzHost
- Module:
- Az.Compute Module
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
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://learn.microsoft.com/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.
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
-HostGroupName
The name of the dedicated host group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InputObject
The dedicated host object.
Parameter properties
| Type: | PSHost |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Host |
Parameter sets
-Name
The name of the dedicated host.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | HostName |
Parameter sets
-ResourceGroupName
The name of the resource group.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceId
The ARM resource id of the dedicated host.
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
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
PSHost
Outputs
PSOperationStatusResponse
Azure PowerShell
Feedback
Was this page helpful?
