For a business case where I’m working on now I have a problem. I have A device which has to write on an Azure PostgreSQL server (https://azure.microsoft.com/nl-nl/services/postgresql/). The device has a dynamic DNS (creating a network or something like that is not an option).
My first thought was creating an Azure automation runbook who adds a firewall rule to the PostgreSQL server. I created the first couple of lines which extracts the IP from the DNS but there seems not a option to create a firewall rule for PostgreSQL.
Code:
$ips = [System.Net.Dns]::GetHostAddresses("dynamicdns.example.net")
$regex = [regex] "\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
$ip2 = $regex.Matches($ips) | %{ $_.value }
Does anyone know A solution to automate the update of the PostgreSQL firewall so this don’t be a manual job anymore?