[x] Tested my code end-to-end against a live Azure subscription.
[x] Updated the documentation in the docs folder for the affected changes.
[x] Written unit tests against the modified code that I have made.
[x] Updated the release notes with a new entry for this PR.
[x] Checked the coding standards outlined in the contributions guide and ensured my code adheres to them.
If I haven't completed any of the tasks above, I include the reasons why here:
Below is a minimal example configuration that includes the new features, which can be used to deploy to Azure:
(*
This creates a virtual network with two subnets, one for application servers and one for database servers. The
application servers and database servers are distributed across two availability zones. The application
servers are connected to both subnets. The database servers use Ultra Disks. All of this deploys to
West US 3, a sustainable datacenter with multiple AZs.
*)
#r "nuget: Farmer"
open System
open Farmer
open Farmer.Builders
let privateNet = vnet {
name "private-net"
build_address_spaces [
addressSpace {
space "10.28.0.0/16"
build_subnet "app-subnet" 27
build_subnet "database-subnet" 28
}
]
}
let appServerZone1 =
vm {
name "app-server-z1"
add_availability_zone "1"
vm_size Vm.Standard_B1ms
username "azureuser"
operating_system Vm.UbuntuServer_2004LTS
os_disk 128 Vm.Premium_LRS
no_data_disk
disable_password_authentication true
link_to_vnet "private-net"
subnet_name "app-subnet"
// Static IP in the app subnet
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.4"))
add_ip_configurations [
// This will generate an additional static IP in the VM's subnet (app-subnet)
ipConfig {
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.5"))
}
// This will generate an additional NIC for the database subnet
ipConfig {
// Assign static IP for the database subnet since database IP's are static
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.38"))
subnet_name (ResourceName "database-subnet")
}
]
add_authorized_keys [
"/home/azureuser/.ssh/authorized_keys", (
IO.File.ReadAllText(
IO.Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".ssh/id_rsa.pub"
)
)
)
]
}
// Second VM in the other availability zone.
let appServerZone2 =
vm {
name "app-server-z2"
add_availability_zone "2"
vm_size Vm.Standard_B1ms
username "azureuser"
operating_system Vm.UbuntuServer_2004LTS
os_disk 128 Vm.Premium_LRS
no_data_disk
disable_password_authentication true
link_to_vnet "private-net"
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.6"))
add_ip_configurations [
ipConfig {
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.7"))
}
ipConfig {
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.39"))
subnet_name (ResourceName "database-subnet")
}
]
add_authorized_keys [
"/home/azureuser/.ssh/authorized_keys", (
IO.File.ReadAllText(
IO.Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".ssh/id_rsa.pub"
)
)
)
]
}
// Database server in zone 1 with ultra disk
let databaseServerZone1 =
vm {
name "database-server-z1"
add_availability_zone "1"
vm_size Vm.Standard_D2s_v5
username "azureuser"
operating_system Vm.UbuntuServer_2004LTS
os_disk 128 Vm.Premium_LRS
// Ultra disk for high performance database needs.
add_disk 4096 Vm.UltraSSD_LRS
disable_password_authentication true
link_to_vnet "private-net"
subnet_name "database-subnet"
// Static IP in the database subnet
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.36"))
public_ip None
add_authorized_keys [
"/home/azureuser/.ssh/authorized_keys", (
IO.File.ReadAllText(
IO.Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".ssh/id_rsa.pub"
)
)
)
]
}
// Database server in zone 2 with ultra disk
let databaseServerZone2 =
vm {
name "database-server-z2"
add_availability_zone "2"
vm_size Vm.Standard_D2s_v5
username "azureuser"
operating_system Vm.UbuntuServer_2004LTS
os_disk 128 Vm.Premium_LRS
// Ultra disk for high performance database needs.
add_disk 4096 Vm.UltraSSD_LRS
disable_password_authentication true
link_to_vnet "private-net"
subnet_name "database-subnet"
// Static IP in the database subnet
private_ip_allocation (StaticPrivateIp (Net.IPAddress.Parse "10.28.0.37"))
public_ip None
add_authorized_keys [
"/home/azureuser/.ssh/authorized_keys", (
IO.File.ReadAllText(
IO.Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".ssh/id_rsa.pub"
)
)
)
]
}
arm {
location Location.WestUS3
add_resources [
privateNet
appServerZone1
appServerZone2
databaseServerZone1
databaseServerZone2
]
}
The changes in this PR are as follows:
I have read the contributing guidelines and have completed the following:
If I haven't completed any of the tasks above, I include the reasons why here:
Below is a minimal example configuration that includes the new features, which can be used to deploy to Azure: