Reset-AzureRoleInstance

Requests a reboot or reimage of a single role instance or all role instances of a specific role.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Service Management APIs. See the Az PowerShell module for cmdlets to manage Azure Resource Manager resources.

Syntax

Reset-AzureRoleInstance
     [-ServiceName] <String>
     -Slot <String>
     -InstanceName <String>
     [-Reboot]
     [-Reimage]
     [-Profile <AzureSMProfile>]
     [-InformationAction <ActionPreference>]
     [-InformationVariable <String>]
     [<CommonParameters>]

Description

The Reset-AzureRoleInstance cmdlet requests a reboot or a reimage of a role instance that is running in a deployment. This operation executes synchronously. When you reboot a role instance, Azure takes the instance offline, restarts the underlying operating system for that instance, and brings the instance back online. Any data that is written to the local disk persists across reboots. Any data that is in-memory is lost.

Reimaging a role instance results in different behavior depending on the type of role. For a web or worker role, when the role is reimaged, Azure takes the role offline and writes a fresh installation of the Azure guest operating system to the virtual machine. The role is then brought back online. For a VM role, when the role is reimaged, Azure takes the role offline, reapplies the custom image that you provided for it, and brings the role back online.

Azure attempts to maintain data in any local storage resources when the role is reimaged; however, in case of a transient hardware failure, the local storage resource may be lost. If your application requires that data persist, writing to a durable data source, such as an Azure drive, is recommended. Any data that is written to a local directory other than that defined by the local storage resource will be lost when the role is reimaged.

Examples

Example 1: Reboot a role instance

PS C:\> ReSet-AzureRoleInstance -ServiceName "MySvc01" -Slot "Staging" -InstanceName "MyWebRole_IN_0" -Reboot

This command reboots the role instance named MyWebRole_IN_0 in the staging deployment of the MySvc01 service.

Example 2: Reimage a role instance

PS C:\> ReSet-AzureRoleInstance -ServiceName "MySvc01" -Slot "Staging" -Reimage

This command reimages the role instances in the staging deployment of the MySvc01 cloud service.

Example 3: Reimage all role instances

PS C:\> ReSet-AzureRoleInstance -ServiceName "MySvc1" -Slot "Production" -Reimage

This command reimages all role instances in the production deployment of the MySvc01 service.

Parameters

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InstanceName

Specifies the name of the role instance to reimage or reboot.

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

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Reboot

Specifies that this cmdlet reboots the specified role instance or, if none is specified, all role instances. You must include either a Reboot or Reimage parameter, but not both.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Reimage

Specifies that this cmdlet reimages the specified role instance or, if none is specified, all role instances. You must include either a Reboot or Reimage parameter, but not both.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ServiceName

Specifies the name of the service.

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

-Slot

Specifies the deployment environment where the role instances run. Valid values are: Production and Staging. You can include either the DeploymentName or Slot parameter, but not both.

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