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.
4
u/[deleted] Jun 16 '17
PowerShell is pretty awesome, but declarative ARM templates are a much better way to roll Azure resources once you get the hang of them, IMHO.