Skip to content

Commit 332e29e

Browse files
authored
Merge pull request #121640 from superfliege/patch-1
Add vm disk attachment to script
2 parents 48daf2f + e593aca commit 332e29e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

articles/virtual-machines/disks-enable-performance.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ $region=desiredRegion
7777
$sku=desiredSKU
7878
#Size must be 513 or larger
7979
$size=513
80+
$lun=desiredLun
8081
8182
Set-AzContext -SubscriptionName <yourSubscriptionName>
8283
8384
$diskConfig = New-AzDiskConfig -Location $region -CreateOption Empty -DiskSizeGB $size -SkuName $sku -PerformancePlus $true
8485
85-
$dataDisk = New-AzDisk -ResourceGroupName $myRG -DiskName $myDisk -Disk $diskConfig
86+
$dataDisk = New-AzDisk -ResourceGroupName $myRG -DiskName $myDisk -Disk $diskConfig
87+
88+
Add-AzVMDataDisk -VMName $myVM -ResourceGroupName $myRG -DiskName $myDisk -Lun $lun -CreateOption Empty -ManagedDiskId $dataDisk.Id
8689
```
8790

8891
To migrate data from an existing disk or snapshot to a new disk with performance plus enabled, use the following script:
@@ -96,12 +99,14 @@ $sku=desiredSKU
9699
#Size must be 513 or larger
97100
$size=513
98101
$sourceURI=diskOrSnapshotURI
102+
$lun=desiredLun
99103
100104
Set-AzContext -SubscriptionName <<yourSubscriptionName>>
101105
102106
$diskConfig = New-AzDiskConfig -Location $region -CreateOption Copy -DiskSizeGB $size -SkuName $sku -PerformancePlus $true -SourceResourceID $sourceURI
103107
104108
$dataDisk = New-AzDisk -ResourceGroupName $myRG -DiskName $myDisk -Disk $diskconfig
109+
Add-AzVMDataDisk -VMName $myVM -ResourceGroupName $myRG -DiskName $myDisk -Lun $lun -CreateOption Empty -ManagedDiskId $dataDisk.Id
105110
```
106111
---
107112

0 commit comments

Comments
 (0)