Nano Server was first made available as a part of Windows Server 2016 Technical Preview 2. Nano Server is a stripped-down version of Windows Server, released by Microsoft specifically for running cloud applications and containers. Nano Server has been officially announced as part of Microsoft Server 2016 launch which will act as a headless installation of Windows Server with a minimal footprint. It lacks a graphical user interface (GUI) and does not come with a Windows installer. Hence, all the management tasks are done using PowerShell and Remote Server Management tools. Due to this fact, we cannot physically access the Server using Remote Desktop Connection. Due to the above mentioned facts, the resources consumed by Nano Server have been drastically reduced with respect to a Full Server installation. It also offers greater speed, stability, and security.
Create Nano Server Virtual Machine using Azure Portal
We can see how to spin up a Nano Server in Azure. In order to do that, select "New" option from Azure Portal and select "Gallery" from Virtual Machine section.
From the images, select Windows Server 2016 – Nano Server, October 2016 option.
Specify the Virtual Machine Name, Size, and the Administrator credentials.
On proceeding to the next page, we will have to provide a cloud service DNS name and Region/Virtual Network. If we already have a Virtual network created and want the Nano Server to be part of the virtual network, we can specify the virtual network name. Else, use the region from which you will be accessing the Server.
Finally, select to install the VM agent and start the creation of the Azure Nano Server Virtual Machine.
After some time, the Virtual Machine will be provisioned and we can see the status and details of the Nano Server Virtual Machine by going to the dashboard of the Virtual Machine.
Create Nano Server Virtual Machine using PowerShell
In this section we will see how to provision the Nano Server using PowerShell. Before creating the Nano Server we will have to fulfill some prerequisites.
Add Trusted Host
In order to remotely connect to the Nano Server from our local machine we will have to register the local computer as a trusted host. The WS-Management TrustedHosts list is a list of trusted resources for your computer. The list consists of comma separated lists of computer names which are considered trusted hosts.
Let’s spin up Windows PowerShell as administrator and see if the computer is already added to trusted hosts by running the command,
get-item wsman:\localhost\Client\TrustedHosts
However since WinRM service is not started yet, we will have to start the WinRM service first.
Start the WinRM service by running the command
Start-Service WinRM
Now let’s run the get-item command once again. This time we can see that the computer is not listed as trusted host.
In order to add the local machine to trusted hosts, we will run the below command.
set-item wsman:\localhost\Client\TrustedHosts -value “Local Machine Name/IP”
We can also run the command to add a wild card character to the trusted host item
set-item wsman:\localhost\Client\TrustedHosts -value *
Now rerunning the get-item command will list the local machine in the trusted hosts.
Install Azure PowerShell Module
We can get the Azure PowerShell module from here http://aka.ms/webpi-azps . It will download the Web platform installer file which can be used for Azure PS Module installation. Proceed with the installation as shown below.
This would take some time to complete the installation procedure.
Get the NanoServerAzureHelper Module
We can get the NanoServerAzureHelper module from here
This module contains the cmdlets that will help us create a new Nano Server instance in the recently created Virtual Machine remotely.
Add AzureRM Resource Group and AzureRM Key Vault
Now let’s remotely connect to Azure using the Azure PowerShell module which we had installed recently. In the PowerShell Console which we had opened as administrator add the below command.
Add-AzureRmAccount
This will connect to the Azure subscription account and we can run PowerShell script against this Azure account.
Let’s create an AzureRM Resource group and AzureRM key Vault by running the below commands.
New-AzureRmResourceGroup -Name "NanoGroup" -Location "Southeast Asia"
New-AzureRmKeyVault -VaultName "NanoGroupVault" -ResourceGroupName "NanoGroup" -Location "Southeast Asia" –EnabledForDeployment
Create a new Nano Server
Let’s unzip the NanoServerAzureHelper zip file we had downloaded earlier. Make this folder the working directory of PowerShell.
Run the below command to import the module so that we can use the “New-nanoServerVM” cmdlet present within it to create the new Nano Server .
Import-Module .\NanoServerAzureHelper.psm1 –Verbose
Thus the module has been loaded. We can now run the below command to create the new nano server.
New-NanoServerAzureVM -Location "Southeast Asia" –VMName "nanoservervm" -AdminUsername "AdminNano" -VaultName "NanoGroupVault" -ResourceGroupName "NanoGroup" –Verbose
The parameters are quite self-explanatory and we are using the Resource Group and key Vault created earlier. Make sure that you use only numbers and lowercase letters for the VM Name, else we will get the below error.
The provisioning of the VM will take some time to complete.
Once completed, we will get the below success message.
Connect to Azure Nano Server
We can go ahead and create a secure PowerShell remote session with the Nano server. In order to do that we must first get the fully qualified domain name of the Nano Server which can be obtained by running the below command,
Get-AzureRmPublicIpAddress -ResourceGroupName "NanoGroup"
Copy the Fqdn from the DnsSettings section and use it in the below “Enter-PSSession” cmdlet.
Enter-PSSession -ConnectionUri "https://nanoservervm.southeastasia.cloudapp.azure.com:5986/WSMAN" -Credential AdminNano
Specify the admin password which we had created using the Nano sever provisioning process.
We have now successfully established a session into the Azure Nano Server using PowerShell
Since Nano Server comes with minimalistic roles and features, we will have to install the required roles and features by installing the packages. Now let’s try to install the NanoServerPackage.
However In case you face any catalog signature issues you can use the below script to get the package module installed.
Install-Module -Name NanoServerPackage -SkipPublisherCheck -force
Install-PackageProvider NanoServerPackage
Set-ExecutionPolicy RemoteSigned -Scope Process
Import-PackageProvider NanoServerPackage
Once done, we can run the below command to see the available roles which we can install in the server.
Find-NanoServerPackage -Name *
As shown above, we have the DNS Package available which we will try to install in the server. Run the below command to install the DNS package.
Install-NanoServerPackage Microsoft-NanoServer-DNS-Package -Culture en-us
Finally, the DNS package installation is completed.
Now, let’s enable the DNS Server in our Nano Server Instance.
Enable-WindowsOptionalFeature -Online -FeatureName DNS-Server-Full-Role
import-module DNSServer
Finally, the DNS Server Role has been enabled. Let’s test the DNS Server role by running the Get-DNSServer command.
We can similarly get the entire DNS Server commands by running the Get-Command -Module DNSServer cmdlet, as shown below.
Summary
Thus, we saw how to set up Nano Server in Azure and configure the DNS Server Role in the Nano Server.