This is exactly how @raphaelblg mentioned.
You have to dig into the MS docs about VM size.
You cant look just on "hey it is less memory, why is more expensive" ? It is not jus that.
In your example where you compare Dv2 to Dv3 Series you can find in docs that MS changed Memory to CPU ratio so it will be more efficient and also it runs in hyper-threaded configuration. They also adjusted disk and network limits to align with the move to hyperthreading.
Hyperthreading = improve parallelization of computations.
In DS5 V2 you have much higher IOPS and network bandwidth.
It is advised that you move to Ev3 and Esv3-series if you look for Memory optimized machines.
Please be aware of azure regions, there might be situation when machine "X" is more expensive then machine "Y" but in other region it might not be the same 🙂
So if you swap you compute, you might see drop in performance.
If you are looking for some savings you need to:
- test different VMs
- check spot instances
- run Job clusters instead (maybe with pool for faster start-up)
I hope that I was able to clarify few things for you 🙂