We have Set-AzureRmVMOSDisk executed 2 times for second vm. First VM creates successfully without error, but when we creating second vm script generates an error.
If string 116 exist, script complete with error " New-AzureRmVM : Parameter 'osDisk.managedDisk' is not allowed."
Just remove this string and script will execute without error.
Please remove string number 116 that states as
$vm2 = Set-AzureRmVMOSDisk -VM $vm2 -Name $using:vm2osDiskName -StorageAccountType StandardLRS -DiskSizeInGB $using:vmosDiskSize -CreateOption fromImage -Caching ReadWrite
We have Set-AzureRmVMOSDisk executed 2 times for second vm. First VM creates successfully without error, but when we creating second vm script generates an error. If string 116 exist, script complete with error " New-AzureRmVM : Parameter 'osDisk.managedDisk' is not allowed." Just remove this string and script will execute without error.