[Free VPS] Create a Free Tier Windows/Linux Azure VPS VM - NETSEC


Learning, Sharing, Creating

Cybersecurity Memo

Saturday, October 12, 2019

[Free VPS] Create a Free Tier Windows/Linux Azure VPS VM

Azure free tier provides following free services for 12 months after one month for your free $200 credit:
  1. 750 hours B1S VM Windows Virtual machines
  2. 750 hours B1S VM Linux Virtual machines
  3. 64GB x 2 Storage - 2 P6 SSDs
  4. 5 GB File Storage
  5. 250 GB SQL DB
  6. 15 GB Bandwidth (Data Transfer)
  7. etc
Basically, you can run two virtual machines (one for windows , one for linux) free for a year. If you have student subscription, even after one year and your subscription got renewed, this free tier will still be valid to use. You two free VMs will be still staying on free tier. There are quire a few tricks which might get you drop into Microsoft Azure's trap to cause a charge. Read this post thoroughly, you will avoid this kind of charge trapps. 

For Windows Machines

I was thinking to test free tier Windows VM to see if it is really free. And found if I am using a VM with following options, the free tier does not apply to this VM's storage option. By default, it will give you 128  GB storage and there is not option for you to make change for your disk to P6 SDD.

You will need to choose 60GB (P6) to be eligible for free account. If you choose wrong, even smaller size, you will get some kind of storage charges.

The daily charge comes from storage since this VM size is using s10 disk type . Daily charge will be around $0.25. It was not that much but I really want to find out how we can really enjoy the free tier services as much as we can.

After some research and I found that is because of the image we selected for this VM. If I am use those predefined Windows 2012 image, it will come with 128GB S10 disk.

To avoid that, I will have to choose [smalldisk] image, such as [smalldisk] Windows Server 2012 Datacenter or [smalldisk] Windows Server 2012 R2 Datacenter as show from following screenshot:

Note: Small Disk image will only give you 30GB OS disk from wizard. But you can resize it to 64GB P6 level. 

After that , in Disks window, you will have disk options available for you to choose a free account eligible P6 disk.

[Updated on April 2022] The method is still working, but the interface is different. 

If you want to be fully deducted by the free quota of Azure, there are mainly the following three pitfalls: The first is that the availability option must choose no infrastructure redundancy, otherwise you will be unable to use the dynamic IP of the basic SKU, so Microsoft will give You will not be able to use the quota of your dynamic IP; the second Windows system image must be marked with smalldisk, otherwise it will not be able to be compressed back because the system disk is larger than the P6 SSD; the third is the instance and disk type, the instance must be B1s, and the disks are premium SSDs (P6 64GB) (not standard SSD or HDD).

Here are some screenshots when you are trying to find out "Small Disk" image from Marketplace's Windows Server image:

Again, small disk image will give you only 30G P4 size disk for your VPS VM. 

You will have to stop the VM and go to disk page to resize from P4 32GB to P6 64GB for free tier usage.

For Linux Machines

It should be very straightforward. Only thing you will need to pay attention to is the disk size. You  will need to choose 64GB P6 Free account eligible disk. By default, it will give you 30GB default size.

If you missed that, you are still able to change it after you stopped Linux VM.
1)After you created your Linux VM with right size (B1S), you will need to stop it before you can resize it.

2) After Linux VM stopped, you can choose Disks from right column

3) After found your Linux Disk, choose Configuration. You will find the option to choose your disk type and size. Change size from 30 to 64. After enter 64, you will find both IOPS and throughput limit changed to better value. 

4) After made the disk size change, go back to virtual machine page to start your Linux VM . 

Public IP Address - Create New & Choose Dynamic One

Microsoft Azure will charge you if you are using a static Public IP address. 

[Updated on April 2022] 
By default, Microsoft Azure will allocate you a static public ip address. 

If you would like to have dynamic public ip, you will have to go through create ip option to get a basic SKU and dynamic ip.

If you missed this step, you will have to stop your VM, disassociate your public ip to delete the static public ip then create a new dynamic one to re-associate to your VM.

Increate Virtual Memory

Ideally, your paging file size should be 1.5 times your physical memory at a minimum and up to 4 times the physical memory at most to ensure system stability. For example, say your system has 8 GB RAM. You can calculate your minimum paging file size with this equation: 8 GB x 1.5, and your maximum paging file size with this one: 8 GB x 4. The totals would be 12 GB and 32 GB of RAM respectively. ()

By default, paging file is system managed by using a temporary storage driver D which has 4GB.
Once VM is up, it will only use 512MB on D drive. That is actually too small for you to run other applications. 

To maximize the performance, you might want to increase it to initial size to 2048 and Maximum size to 3072. The reason why maximum size is not set to maximum size as show the following screenshot, it is still some available space for other temporary  files or folders. In this kind of set up, we still keep 1GB for those temporary system files on D drive.

\Paging File\% Usage” displays the percentage of the paging file that is currently in use. A paging file is a hidden, optional system storage file on a hard disk. The paging file extends the RAM’s capacity because it stores RAM data that has not been used or accessed lately. Operations that exceed the limited RAM space are automatically sent to the file to be stored if you have the paging file enabled.

If your counter shows that your paging file has reached or is nearing 100% current usage, then your system and applications will not be able to function properly. You want your paging file to be large enough that, at any given time, only 50% to 75% of it is being used at most.   


One of these three solutions should resolve your paging file problems:


1. Identify and address which application/services are using the most of the server’s memory.

2. Add on to your memory.

3. Increase your paging file size.


  • 从cloud shell用命令建的机器不指定其它参数的话默认是d系列,两个硬盘,都不免费。
  • 从cloud shell上stop机器的话收费照旧因为占用的资源依旧保留。一定要deallocate。


Updated video on Apr 2022


No comments:

Post a Comment