This is the second chapter – create public IP address and DNS Zone connectivity – of the Scalable, Highly Available, Secure WordPress on Azure series; In here I am going to create a Azure service component – Public IP – and will establish the connectivity with the DNS Zone.
Static IP and establishing DNS connectivity
As the first step, I will create a static public IP and establish connection with the existing DNS zone by creating an ‘A’ record inside the DNS record set. The scripts to execute is ‘1-create-public-IP-connect-DNS.ps1‘. The script creates a static public IP which bridges the connection between the external internet and our solution.
In the script, first script finds if an existing public address component of same name already exists (Get-AzPublicIpAddress) and if it does not, it creates a new instance (New-AzPublicIpAddress)
$publicIp = Get-AzPublicIpAddress `
-Name $publicIpName `
-ResourceGroupName $RESOURCEGROUP_NAME `
-ErrorAction SilentlyContinue
if (!$publicIp)
{
Write-Host -ForegroundColor Green "create a new static IP address ... ";
$publicIp = New-AzPublicIpAddress -Name $publicIpName `
-ResourceGroupName $RESOURCEGROUP_NAME -AllocationMethod Static `
-DomainNameLabel $dnsPrefix -Location $LOCATION -Sku "Standard"
}
Once the public IP component has been created, I associate and couple this IP address within the DNS records from our DNS provide (GoDaddy.com in my case). I create two ‘A’ records (specifying the public IP addresses ) and one CNAME record as shown in the following diagram.
[Validation Tests]: Log on to the Azure portal – https://portal.azure.com. Manually validate that the component ‘SitePublicip-v2‘ of type ‘Public IP address’ has been created.
After the execution and configuration of previous steps, I’ve achieved the following connectivity of my final target architecture.