Get-AzureDataDisk

Gets Azure data disks.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Get-AzureDataDisk
   [[-Lun] <Int32>]
   -VM <IPersistentVM>
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Get-AzureDataDisk cmdlet gets an object that represents the data disks on an Azure virtual machine. To get a specific data disk object, specify the logical unit number (LUN) of the disk.

Examples

Example 1: Get all data disks for a virtual machine

PS C:\> Get-AzureVM "ContosoService" -Name "VirtualMachine07" | Get-AzureDataDisk

This command gets the virtual machine named VirtualMachine07 in the service named ContosoService by using the Get-AzureVM cmdlet. The command passes the virtual machine to the current cmdlet by using the pipeline operator. The current cmdlet gets all the data disks for this virtual machine.

Example 2: Get a specific data disk for a vituralvirtual machinevirtual

PS C:\> Get-AzureVM "ContosoService" -Name "VirtualMachine07" | Get-AzureDataDisk -LUN 2

This command gets the virtual machine named VirtualMachine07 in the service named ContosoService. The command passes the virtual machine to the current cmdlet. The current cmdlet gets the data disk that has the LUN 2.

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

-Lun

Specifies the LUN for the data drive in the virtual machine. Valid values are: 0 through 15.

Type:Int32
Position:0
Default value:None
Required:False
Accept pipeline input:False
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

-VM

Specifies the virtual machine object for which this cmdlet gets data disks. To obtain a virtual machine object, use the Get-AzureVM cmdlet.

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