Hi All
I have a windows 2019 server hosted in Azure. I want to add additional drive to it. The server currently has operating system drive only.
I want to add additional drive using PowerShell. i am not sure what should be the default caching or recommended value to be set for additional drive. please guide me. if i dont mention caching what value will it take. in the below syntax i just put ReadOnly but i am not sure
$vmName = "Server01"
$disk_name = "_DataDrive"
$size = 100
$lun = 0
$vm = Get-AzVM -Nam $vmName
$rgName = $vm.ResourceGroupName
$location = $vm.location
$storageType = 'Premium_LRS'
$dataDiskName = $vmName + $disk_name
$tags = $vm.Tags
$diskConfig = New-AzDiskConfig -SkuName $storageType -Location $location -CreateOption Empty -DiskSizeGB $size -tag $Tags
$dataDisk1 = New-AzDisk -DiskName $dataDiskName -Disk $diskConfig -ResourceGroupName $rgName
$vm = Add-AzVMDataDisk -VM $vm -Name $dataDiskName -CreateOption Attach -ManagedDiskId $dataDisk1.Id -Lun $lun -Caching 'ReadOnly'
Update-AzVM -VM $vm -ResourceGroupName $rgName