Here is a simple task list for the subject setup
- Download the script module, template and makecert files to your local drive; deployment instructions also exist
https://www.thomasmaurer.ch/tag/remoting/
- Deployment code snippet
Set-ExecutionPolicy -ExecutionPolicy Bypass
Import-Module C:\NanoServerAzureHelper_20160927\NanoServerAzureHelper.psm1 -Verbose
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
New-AzureRmResourceGroup -Name "NanoGroup" -Location "Southeast Asia"
New-AzureRmKeyVault -VaultName "NanoVault" -ResourceGroupName "NanoGroup" -Location "Southeast Asia" –EnabledForDeployment
New-NanoServerAzureVM -Location "Southeast Asia" –VMName "nanoservervm" -AdminUsername "AdminNano" -VaultName "NanoVault" -ResourceGroupName "NanoGroup" –Verbose
- Remote connection to Nano VM (You need a GUI Windows VM in the network where Nano is to remote manage Nano VM)
New-PSSession -ConnectionUri https://nanoservervm.southeastasia.cloudapp.azure.com:5986/WSMAN -Credential AdminNano
- Disable Windows firewall
New-AzureStorageContainer -Name ext -Permission Blob -Context ((Get-AzureRmStorageAccount -Name nanostg -ResourceGroupName NANOSE).Context)
Set-AzureStorageBlobContent -File VMCustExt.PS1 -Container ext -BlobType Block -Context ((Get-AzureRmStorageAccount -Name nanostg -ResourceGroupName NANOSE).Context)
$Location = Get-AzureRmLocation|Where-Object{$_.DisplayName -eq 'Southeast Asia'}
$LocationName = $location.DisplayName
$rgName = Get-AzureRmResourceGroup -Location $locationName | Select-Object -Property ResourceGroupName -ExpandProperty ResourceGroupName
$vmList = gc 'C:\vmlist.txt'
$vmlist | % {
$StgKey = (Get-AzureRmStorageAccountKey -Name nanostg -ResourceGroupName NANOSE).Value[0]
Set-AzureRmVMCustomScriptExtension -ResourceGroupName NANOSE -VMName $_ -Location 'Southeast Asia' -Name VMCustExt -FileName 'VMCustExt.PS1' -StorageAccountName nanostg -StorageAccountKey $StgKey -ContainerName ext -Run 'VMCustExt.PS1'
}
netsh advfirewall set allprofiles state off #--> This cmdlet must go into 'VMCustExt.PS1'
- Configure firewall for remote management and services
$rulesHTTP = New-AzureRmNetworkSecurityRuleConfig -Name HTTP -Protocol Tcp -Description "HTTP" -SourcePortRange * -DestinationPortRange 80 -SourceAddressPrefix * -DestinationAddressPrefix * -Access Allow -Priority 101 -Direction Inbound
$nsgNano = New-AzureRmNetworkSecurityGroup -Name NanoSG -ResourceGroupName Nanogroup -Location 'Southeast Asia' -SecurityRules $rulesHTTP
$NanoNIC = Get-AzureRmNetworkInterface -Name nanoservervm-NIC -ResourceGroupName Nanogroup
$NanoNIC.NetworkSecurityGroup = $nsgNano
Set-AzureRmNetworkInterface -NetworkInterface $NanoNIC
- Enable and configure IIS
#Start the WinRM service on the local PC which is in the same network as the remote machine (Nano system) and accessible
Start-Service WinRM
#Enable access to the remote machine
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "nanoservervm"
#Logon to the remote machine
$cred = Get-Credential
Enter-PSSession -ComputerName nanoservervm -Credential $cred
#Install the package provider
Install-PackageProvider NanoServerPackage
Find-NanoServerPackage -Name *
Install-NanoServerPackage -Name Microsoft-NanoServer-IIS-Package -Culture en-us -Verbose
#Alter the content of the default webpage
PSEdit .\iisstart.htm
#Start the IIS (By default any newly installed service/package will be in stopped mode and has to be manually started)
Start-Service W3SVC
- Launch the website