Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Add-AzVmssDataDisk
- Module:
- Az.Compute Module
Adds a data disk to the VMSS.
Syntax
Default (Default)
Add-AzVmssDataDisk
[-VirtualMachineScaleSet] <PSVirtualMachineScaleSet>
[[-Name] <String>]
[[-Lun] <Int32>]
[[-Caching] <CachingTypes>]
[-WriteAccelerator]
[-CreateOption <String>]
[-DeleteOption <String>]
[-DiskSizeGB <Int32>]
[-DiskIOPSReadWrite <Int64>]
[-DiskMBpsReadWrite <Int64>]
[-StorageAccountType <String>]
[-DiskEncryptionSetId <String>]
[-StorageFaultDomainAlignment <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Add-AzVmssDataDisk cmdlet adds a data disk to the Virtual Machine Scale Set (VMSS) instance.
Examples
Example 1: Add a data disk
$vmss = New-AzVmssConfig -Location $Loc -SkuCapacity 2 -SkuName "Standard_A0" -UpgradePolicyMode "Automatic"
$vmss = Add-AzVmssDataDisk -VirtualMachineScaleSet $vmss -Name 'DataDisk1' -Lun 0 -Caching 'ReadOnly' -CreateOption Empty -DiskSizeGB 10 -StorageAccountType Standard_LRS
This command adds an empty data disk to the VMSS object.
Parameters
-Caching
Specifies the caching type of the disk.
Parameter properties
| Type: | |
| Default value: | None |
| Accepted values: | None, ReadOnly, ReadWrite |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-CreateOption
Specifies the create option of the disk.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-DeleteOption
Specifies whether data disk should be deleted or detached upon VMSS Flex deletion (This feature is available for VMSS with Flexible OrchestrationMode only)
Accepted Values Delete - If this value is used, the data disk is deleted when the VMSS Flex VM is deleted. Detach - If this value is used, the data disk is retained after VMSS Flex VM is deleted.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DiskEncryptionSetId
Specifies the resource Id of customer managed disk encryption set. This can only be specified for managed disk.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DiskIOPSReadWrite
Specifies the Read-Write IOPS for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.
Parameter properties
| Type: | Int64 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DiskMBpsReadWrite
Specifies the bandwidth in MB per second for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.
Parameter properties
| Type: | Int64 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DiskSizeGB
Specifies the size of the disk in GB.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Lun
Specifies the logical unit number of the disk.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
Specifies the name of the disk.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StorageAccountType
Specifies the storage account type of the disk.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StorageFaultDomainAlignment
Specifies the storage fault domain alignment type for a data disk in the VMSS template. Valid values are 'Aligned' and 'BestEffortAligned'. 'Aligned' maps disk Storage Fault Domains to Compute Fault Domains; deployment fails if disk doesn't support enough FDs. 'BestEffortAligned' attempts mapping but leaves the disk unaligned if it doesn't support enough FDs. Applicable to VMSS Flex only.
Parameter properties
| Type: | String |
| Default value: | None |
| Accepted values: | Aligned, BestEffortAligned |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-VirtualMachineScaleSet
Specify the VMSS object. You can use the New-AzVmssConfig cmdlet to create the object.
Parameter properties
| Type: | PSVirtualMachineScaleSet |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
-WriteAccelerator
Specifies whether WriteAccelerator should be enabled or disabled on the data disk.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
CommonParameters
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.
Inputs
PSVirtualMachineScaleSet
String
Int32
Nullable<T>
Outputs
PSVirtualMachineScaleSet
Azure PowerShell
Feedback
Was this page helpful?
