Get-AzureRole

Returns a list of roles in your Microsoft Azure service.

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

Get-AzureRole
   [-ServiceName] <String>
   [[-Slot] <String>]
   [[-RoleName] <String>]
   [-InstanceDetails]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Get-AzureRole cmdlet returns a list object with details on the roles in your Microsoft Azure service. If you specify the RoleName parameter, Get-AzureRole returns details on that role only. If you specify the InstanceDetails parameter, additional, instance-specific details are returned.

Examples

Example 1: Get a list of roles for a service

PS C:\> Get-AzureRole -ServiceName "MySvc01" -Slot "Production"

This command returns an object with details on all the production roles running on the MySvc01 service.

Example 2: Get details on a role running on a service

PS C:\> Get-AzureRole -ServiceName "MySvc1" -Slot "Staging" -RoleName "MyTestVM3"

This command returns an object with details on the MyTestVM3 role, running on the staging environment of the MySvc01 service.

Example 3: Get instance information on instances of a role running on a service

PS C:\> Get-AzureRole -ServiceName "MySvc01" -Slot "Production" -RoleName "MyTestVM02" -InstanceDetails

This command returns an object with details on the instances of the MyTestVM02 role running in the production environment on the MySvc01 service.

Example 4: Get a table of the role instances associated with a service

PS C:\> Get-AzureRole -ServiceName "MySvc01" -Slot "Production" -InstanceDetails | Format-Table -Auto "InstanceName", "InstanceSize", "InstanceStatus"

This command returns a table of the instance name, size, and status of all role instances running in the production environment on 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

-InstanceDetails

Specifies that this cmdlet returns details about the instances on each role.

Type:SwitchParameter
Position:3
Default value:None
Required:False
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

-RoleName

Specifies the name of the role to get.

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

-ServiceName

Specifies the name of the Azure service.

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

-Slot

Specifies the Azure deployment environment. The acceptable values for this parameter are: Production or Staging.

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