Yes, Azure VMs with Linux at the guest level uses the swap space when required which is similar to page file in windows.
The Azure Linux Agent or Cloud-init can be used to configure swap space using the local resource disk. This resource disk is attached to the VM after provisioning on Azure. The local resource disk is a temporary disk, and might be emptied when the VM is deprovisioned. The following blocks show how to configure this swap.
Note: Do not create swap space on the OS disk.
Azure Linux Agent Modify the following parameters in /etc/waagent.conf
ResourceDisk.Format=y
ResourceDisk.Filesystem=ext4
ResourceDisk.MountPoint=/mnt/resource
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=2048 ## NOTE: Set this to your desired size.
More detailed steps that you need to follow are available at General Linux System Requirements look from step#7
Additional details:
You can check how the system is doing memory wise by running the “free” command from the Linux shell prompt, and in particular, you can use “cat /proc/swaps” to see the state of the swap space – how much is configured and how much is in use. See the screenshot, below.
Note: For cases where the swap space is not configured at all, as is the default case with Linux VM’s provisioned in Windows Azure Virtual Machines, the “cat /proc/swaps” will return nothing, and likewise the “free” command will not show any activity in swap.
Hope this helps! :)
If this response has answered your query, please 'Accept as Answer' and Upvote using "Thumbs-up" so that the relevancy of this post will improve when anyone in the community search for a similar query.