The first command gets an existing managed disk.
The next command gets an existing Vmss VM given by the resource group name, the vmss name and the instance ID.
The next command adds the managed disk to the Vmss VM stored locally in $VmssVM.
The final command updates the Vmss VM with added data disk.
Parameters
-Caching
Specifies the caching mode of the disk.
The acceptable values for this parameter are:
ReadOnly
ReadWrite
None
The default value is ReadWrite.
Changing this value causes the virtual machine to restart.
This setting affects the consistency and performance of the disk.
Specifies whether this cmdlet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk.
The acceptable values for this parameter are:
Attach.
Specify this option to create a virtual machine from a specialized disk.
When you specify this option, do not specify the SourceImageUri parameter.
The VhdUri is all that is needed in order to tell the Azure platform the location of the virtual hard disk (VHD) to attach as a data disk to the virtual machine.
Empty.
Specify this to create an empty data disk.
FromImage.
Specify this option to create a virtual machine from a generalized image or disk.
When you specify this option, you must specify the SourceImageUri parameter also in order to tell the Azure platform the location of the VHD to attach as a data disk.
The VhdUri parameter is used as the location identifying where the data disk VHD will be stored when it is used by the virtual machine.
Specifies the local virtual machine scale set VM object to which to add a data disk.
You can use the Get-AzVmssVM cmdlet to obtain a virtual machine scale set VM object.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.