In this easy Ask the Admin, I’ll show you how to quickly downsize a Microsoft Azure virtual machine (VM) to run Windows Server Core with minimum resources.
Azure’s gallery images provide a quick way to get VMs up and running without having to customize and upload operating system images to the cloud. But if you’ve ever provisioned an Azure VM, you will have noticed the Windows Server images boot with the full GUI and administration tools, and that there are no images pre-configured to boot to Server Core, despite being the default option when installing Windows Server directly from media.
Downsizing to an ‘extra small’ server core virtual machine can save system resources. (Image: Dreamstime)
From a user perspective, this provides a familiar experience for those who are not familiar with the command line. But the disadvantage is that the GUI, and all the associated tools, require more resources than Server Core, and historically forty five percent more patches. Therefore it makes sense if possible to deploy Server Core, to simplify the monthly patching process and reduce memory and CPU overheads, in turn lowering costs.
Small and medium are the smallest sizes that you should pick when initially deploying Windows Server 2012 R2 in Azure, if only to make sure you have a responsive experience when performing initial configuration tasks with the GUI. But Azure provides extra small VMs with 1GHz CPU and 768MB RAM, and can cost less the $9 a month to run. These tiny VMs are perfect for use with Server Core, and can be used to run roles for small networks such as DNS, IIS and Active Directory domain controllers (DCs).
To remove the GUI and administration tools from Windows Server 2012 R2, run the following PowerShell command and reboot the server.
get-windowsfeature *gui* | uninstall-windowsfeature
Don’t forget that you can move back to the full GUI at any time using the PowerShell command below:
install-windowsfeature -name server-gui-mgmt-infra,server-gui-shell -restart
Now that Server Core is running in the VM, downsize it to extra small. In the command below, I’ve chosen Extra Small from the Basic Tier of instance sizes as opposed to the Standard Tier, which are offered by default. The Basic Tier instance sizes are cheaper to run because they don’t provide load balancing or auto-scaling, have lower disk IOPS, and are good for lab environments.
Downsizing a virtual machine in Microsoft Azure. (Image: Russell Smith)
If you want to downsize to a Standard Tier Extra Small VM, replace Basic_A0 with ExtraSmall. Additionally, you should replace contododc1 in the –servicename and –name parameters with the relevant cloud service name and VM name in your Azure environment.
Before you run the command below, you will need to have the PowerShell tools for Azure configured on your management workstation, and make a connection to your Azure subscription. For more information on managing Azure using PowerShell, see Setup Windows Azure PowerShell Management on Petri.
get-azurevm –servicename “contosodc1” –name “contosodc1” | set-azurevmsize Basic_A0 | update-azurevm
When you run this command, the server will be re-provisioned.
If you don’t want to use PowerShell to downsize the VM, use the Azure Management Portal.
The VM will now be updated to reflect the new instance size. To see the progress of the operation, click NOTIFICATIONS on the left of the portal.