Add-AzureDisk

Adds a disk to the Azure disk repository.

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

Add-AzureDisk
   [-DiskName] <String>
   [-MediaLocation] <String>
   [-Label <String>]
   [-OS <String>]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Add-AzureDisk cmdlet adds a disk to the Azure disk repository in the current subscription. This cmdlet can add a system disk or a data disk. To add a system disk, specify an operating system type by using the OS parameter.

Examples

Example 1: Add a startup disk that uses the Windows operating system

PS C:\> Add-AzureDisk -DiskName "MyWinDisk" -MediaLocation "http://contosostorage.blob.core.azure.com/vhds/winserver-system.vhd" -Label "StartupDisk" -OS "Windows"

This command adds a system disk to your disk repository. The system disk uses the Windows operating system.

Example 2: Add a data disk

PS C:\> Add-AzureDisk -DiskName "MyDataDisk" -MediaLocation "http://yourstorageaccount.blob.core.azure.com/vhds/winserver-data.vhd" -Label "DataDisk"

This command adds a data disk.

Example 3: Add a Linux system disk

PS C:\> Add-AzureDisk -DiskName "MyLinuxDisk" -MediaLocation "http://yourstorageaccount.blob.core.azure.com/vhds/linuxsys.vhd" -OS "Linux"

This command adds a Linux system disk.

Parameters

-DiskName

Specifies the name of the disk that this cmdlet adds.

Type:String
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-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
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

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

Specifies a disk label for the disk that this cmdlet adds.

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

Specifies the physical location of the disk in Azure Storage. This value refers to a blob page in the current subscription and storage account.

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

Specifies the operating system type for a system disk. Valid values are:

  • Windows
  • Linux

If you do not specify this parameter, the cmdlet adds the disk as a data disk.

Type:String
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False

Outputs

DiskContext