Add-AzStackHCIVMVirtualMachineDataDisk

The operation to add a data disk to a virtual machine.

Syntax

Add-AzStackHCIVMVirtualMachineDataDisk
   -ResourceId <String>
   [-DataDiskId <String[]>]
   [-DataDiskName <String[]>]
   [-DataDiskResourceGroup <String>]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Add-AzStackHCIVMVirtualMachineDataDisk
   -Name <String>
   -ResourceGroupName <String>
   [-SubscriptionId <String>]
   [-DataDiskId <String[]>]
   [-DataDiskName <String[]>]
   [-DataDiskResourceGroup <String>]
   [-NoWait]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The operation to add a data disk to a virtual machine.

Examples

Example 1: Add a Data Disk to a Virtual Machine

Add-AzStackHCIVMVirtualMachineDataDisk  -Name 'testVm' -ResourceGroupName 'test-rg'  -DataDiskName 'testVhd'

Name            ResourceGroupName
----            -----------------
testVm          test-rg

This command attaches a data disk to the virtual machine in the specified resource group.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DataDiskId

List of data disks to be attached to the virtual machine passed in Id format

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

-DataDiskName

List of data disks to be attached to the virtual machine passed by Name

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

-DataDiskResourceGroup

Resource Group of the Data Disks

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

-Name

Name of the virtual machine

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

-NoWait

Run the command asynchronously

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

-ResourceGroupName

The name of the resource group. The name is case insensitive.

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

-ResourceId

The ARM Resource ID of the VM

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

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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

Outputs

IVirtualMachineInstance