Hello and welcome to another entry on my blog! In this episode we will create a virtual machine which is going to serve as management server for the environment.
In order for this server to communicate with both our database server and API app, it needs to be present on the same network. In previous entry we’ve already created a virtual network; the only thing we need is dedicated subnet.
For the purpose of demonstration let’s create it manually instead of via Terraform. In resource search look for previously created virtual network, go to subnets tab and hit „+Subnet” and specify the name. All remaining fields can remain as default.

Before creating VM there are few things that need to be specified within Terraform file. It is required to create network interface, ip configuration (with information on subnet where VM needs to reside), and preferably also network security group to allow RDP connections to this VM.
Other than that you need to assign a name to the VM, choose storage plan, source image (I’ve chosen Windows Server 2016) as well as admin username and password used to connect. Entire configuration put together looks like this:
resource "azurerm_network_security_group" "rpgappvm_nsc" {
name = "rpgappvm_nsc"
location = "polandcentral"
resource_group_name = azurerm_resource_group.project2025.name
security_rule {
name = "AllowAnyRDPInbound"
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "3389"
source_address_prefix = "*"
destination_address_prefix = "*"
}
}
resource "azurerm_network_interface" "nic" {
name = "rpgappvm-nic"
location = "polandcentral"
resource_group_name = azurerm_resource_group.project2025.name
ip_configuration {
name = "internal"
subnet_id = "/subscriptions/1d338fad-a9e9-4314-853c-5793eddb8b1b/resourceGroups/project2025/providers/Microsoft.Network/virtualNetworks/rpgapp-network/subnets/rpgapp-vm-subnet"
private_ip_address_allocation = "Dynamic"
}
}
resource "azurerm_windows_virtual_machine" "rpgapp-vm" {
name = "rpgapp-vm"
resource_group_name = azurerm_resource_group.project2025.name
location = "polandcentral"
size = "Standard_F2"
admin_username = "adminuser"
admin_password = var.vm_password
network_interface_ids = [
azurerm_network_interface.nic.id,
]
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2016-Datacenter"
version = "latest"
}
}
After applying Terraform file note an IP address for this resource and connect using any RDP client. Once in I installed pgAdmin to manage the PostgreSQL Flexible server.

That’s it for this entry! In the next blog post I will cover creating development environment in fast and convenient manner using Docker Compose.