Automating the Citrix World using Terraform, Ansible, and Packer (Part 2)

Configuring the Windows-based VMs for WinRM and SSH access

In this part of the Citrix Automation series, let´s configure the Windows-based VMs for WinRM and OpenSSH access.

As the VMs are initially not part of an Active Directory domain, we cannot use a GPO for configuration. It is necessary to configure the Server- and Desktop-Master VMs to accept WinRM and OpenSSH connections so that Ansible and Terraform can be used for further configurations later on. 

All further deployments of Windows-VMs will be based on the Master-VMs…

Installing an Windows Server-based Master VM on Azure

We chose a Standard D2sv5-based Azure VM with Windows Server 2022 DataCenter – Azure Edition as OS.

The deployment of the Azure-based VM was straightforward.
The VM allows no RDP or SSH access over the Internet, RDP connections can only be done using the Jumphost VM.

Configuring the VM for WinRM-based Remote Administration

There are two main components of the WinRM service:
the listener and the service.
The listener listens for requests on one or more ports, each listener has its own configuration.
Each service also has its own authentication options and memory settings.
You can download a script for configuring a WinRM service from GitHub.

After logging on to the VM using local administrative credentials, we configure WinRM using PowerShell:

Let´s check the Win RM listeners:

Get the Service details:

Let´s try WinRM from another Windows computer in the same Network as the Master VM:

The successful output of ipconfig  proves the correct WinRM configuration on the Master Server VM.

If WinRM is not an option, we can install OpenSSH server on the Master VM.
CAUTION: This is not supported by Microsoft.

Configuring the VM for OpenSSH-based Remote Administration

After logging on to the VM using local administrative credentials, we install OpenSSH using the Chocolatey Package Manager.
At first, we must install Chocolatey using PowerShell:

OpenSSH server is now installed and ready to accept SSH-based connections for Remote Administration.

Our Master VM is now ready for configuration using Terraform and Ansible.

In the next part, we will run the first important Ansible Playbooks on the Windows Server-VMs:

  1. Joining the Virtual Machines to an Active Directory Domain
  2. Deploying and Configuring the Citrix Cloud Connector software on the Domain-joined VMs