r/PowerShell • u/tumblatum • Jun 16 '17
Why PowerShell is so complicated?
Ok, this is how do you attache a disk to VM on Azure (according to Azure documentation).
$diskConfig = New-AzureRmDiskConfig -Location EastUS -CreateOption Empty -DiskSizeGB 128 $dataDisk = New-AzureRmDisk -ResourceGroupName myResourceGroup -DiskName myDataDisk -Disk $diskConfig $vm = Get-AzureRmVM -ResourceGroupName myResourceGroup -Name myVM $vm = Add-AzureRmVMDataDisk -VM $vm -Name myDataDisk -CreateOption Attach -ManagedDiskId $dataDisk.Id -Lun 1 Update-AzureRmVM -ResourceGroupName myResourceGroup -VM $vm
Why is this should be five lines? Can't it be simple? For example:
New-AzureRMVMDisk -VM nameofthevm -diskname nameofthedisk -type typeofthedisk etc.
I mean why PowerShell complicates things? After all it is command line tool that should make our life little bit easier.
7
u/BitteringAgent Jun 16 '17
I haven't dealt with PowerShell and Azure VMs....maybe you should write yourself a module to make it easier for you in the future?