azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

Typo in the script provided to Attach the disk

Open MDYShah opened this issue 1 year ago • 2 comments

The variable $vm used two times, second time we can make it $vm1 (or anything) when when adding the Disk, so it can be used as $vm1 in update-azvm command

[$resourceGroup = "myResourceGroup" $location = "WestCentralUS"

$vm = New-AzVm -ResourceGroupName $resourceGroup -Name "myVM" -Location $location -VirtualNetworkName "myVnet" -SubnetName "mySubnet" -SecurityGroupName "myNetworkSecurityGroup" -PublicIpAddressName "myPublicIpAddress"

$dataDisk = Get-AzDisk -ResourceGroupName $resourceGroup -DiskName "mySharedDisk"

$vm = Add-AzVMDataDisk -VM $vm -Name "mySharedDisk" -CreateOption Attach -ManagedDiskId $dataDisk.Id -Lun 0

update-AzVm -VM $vm -ResourceGroupName $resourceGroup]


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

MDYShah avatar Oct 14 '22 21:10 MDYShah

@MDYShah Thanks for your feedback! We will investigate and update as appropriate.

Naveenommi-MSFT avatar Oct 15 '22 03:10 Naveenommi-MSFT

@MDYShah Could you please help us with the screenshot and mark the line that changes to be made. So, it will be helpful for us to make necessary changes.

Thanks.

AjayBathini-MSFT avatar Oct 17 '22 07:10 AjayBathini-MSFT

@MDYShah We are going to close this thread but if there are any further questions in the documentation, please tag me in your reply and we will be happy to continue the conversation.

AjayBathini-MSFT avatar Oct 19 '22 09:10 AjayBathini-MSFT