Q: How can I check the virtual IP address of my Azure cloud service from Azure?
A: I started off thinking this would be a simple PowerShell command; however; I couldn't find a cmdlet to uncover the virtual IP address. My initial solution, which follows, is fairly ugly:
$servicename = 'SavillTech102' $servURL = Get-AzureDeployment -ServiceName $servicename -Slot "production" | ` Select-Object -expandproperty Url | Select-Object -expandproperty DnsSafeHost [System.Net.Dns]::GetHostAddresses($servURL) | foreach {echo $_.IPAddressToString }
This solution works by finding the DNS name of the cloud service, then performing a DNS lookup to find the IP address.
I found that I could dump out a debug view of a service, which contained the virtual IP address in a body of XML; however, this method is also quite difficult:
Get-AzureRole -ServiceName $servicename -Slot Production -InstanceDetails -Debug
The final solution was the following PowerShell code, which works great and is easy to understand.
$d = Get-AzureDeployment -ServiceName $servicename -Slot Production $d.VirtualIPs[0].Address
0 comments
Hide comments