< Back

Get-AzureDataDisk

Wed Jan 30, 2019 5:43 pm

NAME Get-AzureDataDisk



SYNOPSIS

Gets Azure data disks.





SYNTAX

Get-AzureDataDisk [[-Lun] <Nullable`1[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.





PARAMETERS

-Lun <Nullable`1[Int32]>

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



Required? false

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-VM <IPersistentVM>

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



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-Profile <AzureSMProfile>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationAction <ActionPreference>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationVariable <String>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES









-------------------------- 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 vitural machine --------------------------



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.



RELATED LINKS

Add-AzureDataDisk

Get-AzureVM

Remove-AzureDataDisk

Set-AzureDataDisk