How to deploy Nano Server in Azure
In some other post I have written how you can deploy a Nano Server on premise using PowerShell or the Nano Server Image Builder. In this post I will quickly show you how you can setup a new Nano Server in Microsoft Azure.
To deploy Nano Server in Azure, Microsoft offers you a Nano Server Image in the Marketplace.
Using the Azure Portal to deploy Nano Server on Microsoft Azure
There are also several ways you can deploy Nano Server, for example using the Azure Portal or PowerShell. First this will show you how you can create a Nano Server Virtual Machine using the Azure Portal.
Simply follow the steps to create a new Azure Virtual Machine.
The most important part is to configure the Network Security Groups to allow PowerShell Remoting since Nano Server does not support RDP. There are two options to do this, using WinRM over http (5985) or using WinRM using https (5986). To be honest in production you should only use https, but for some demos or if you are configuring Nano Server to be used over a VPN you can also use WinRM over http. I also recommend that you remove the RDP port rule, since this is not really necessary. If the WinRM rule in the network security group is not already there, just create it. For easy setup you can use 5985 if you want to use SSL you will require additional steps.
Follow the rest of the wizard to deploy the new Nano Server VM. After the VM is created you will see it in the Azure Portal. You can now use the IP address to connect to the virtual machine using PowerShell remoting. If you don’t have a VPN connection to the Azure VM Network you will need to use the public IP address, if it is connected trough a VPN or from another machine running in the same VM Network, you can use the internal IP address. In my demo case I am using the public IP address to connect to the virtual machine. To make it easier I also created a Public DNS name for this Azure IP address.
To connect to your Nano Server you also have to setup PowerShell Remoting on your machine and add the host to your trusted hosts group.
<div># Start the WinRM Service</div>
<div>Set-Item WSMan:\localhost\Client\TrustedHosts -Value "servername or IP"</div>
You can now connect to your Nano Server running in Azure.
Enter-PSSession -ComputerName tomsnano02.westeurope.cloudapp.azure.com -Credential ~\ThomasMaurer
Using the Azure PowerShell module to deploy Nano Server on Microsoft Azure
Time to fire up PowerShell and login to Azure
First create a new Azure Resource Group and a Key Vault if you don’t have them already available. The key vault will be helping you to use SSL configuration for your PowerShell remoting.
New-AzureRmResourceGroup -Name “NanoServerAzurePS” -Location "West Europe"
New-AzureRmKeyVault -VaultName “NanoServerAzurePSVault” -ResourceGroupName “NanoServerAzurePS” -Location "West Europe" -EnabledForDeployment
Import the NanoServerAzureHelper PowerShell module which you have downloaded before.
Import-Module .\PowerShell\NanoServerAzureHelper_20160927\NanoServerAzureHelper.psm1 -Verbose
This will give you some new PowerShell cmdlets to deploy Nano Server quickly on Azure.
The most important for creating new Nano Server VMs in Azure is simply the New-NanoServerAzureVM.
Create a new Nano Server VM in Azure using the following PowerShell command:
New-NanoServerAzureVM -Location "West Europe" –VMName "tm01-nanops" -AdminUsername "ThomasMaurer" -VaultName "NanoServerAzurePSVault" -ResourceGroupName "NanoServerAzurePS" -Verbose
To connect you can get the public IP address for the system you deployed and connect to it
Get-AzureRmPublicIpAddress -ResourceGroupName "NanoServerAzurePS"
Enter-PSSession -ConnectionUri "https://tm01-nanops.westeurope.cloudapp.azure.com:5986/WSMAN" -Credential "~\ThomasMaurer"
Using PowerShell Package Management to Install Roles and Features on Nano Server
Since in Nano Server does not include any roles per default you can now use PowerShell Package Management to installed Nano Server Packages on your Azure Virtual Machine.
If you want to know more about PowerShell Package Management on Nano Server, check out my blog post. If you want to know more about Nano Server in general check this post here: Nano Server – The future of Windows Server – Just enough OS