@Badrinath V You should be able to get the vmSize
by calling the Virtual Machines - Get REST API and then get the memoryInMB
value for that size from the Virtual Machine Sizes - List REST API.
Depending on the language you are using for your code, you could use the respective Azure SDKs as well.