Windows Azure Cloud Service application can be accessed via either site URL or public virtual IP (VIP) address.
The site URL is compose from either service name (for production deployment) or deployment id (for staging deployment) and cloudapp.net domain name.
In order to get public virtual IP for a service using PowerShell (PS) we need to:
- Get service details using
Get-AzureDeployment
PS command - Get IP address using
System.Net.Dns
.NET class
Get service details
In order to fetch service detail we run command as follows:
Get-AzureDeployment -ServiceName service_name
For staging deployment we need to add -Slot Staging parameter
Get-AzureDeployment -ServiceName service_name -Slot Staging
Get IP address
In order to get IP address we call GetHostAddresses static method of System.Net.Dns .NET class providing Windows Azure service host name as a parameter and print IP address of each address.
[System.Net.Dns]::GetHostAddresses(host) | foreach { $_.IPAddressToString }
Single line PS command is as follows:
[System.Net.Dns]::GetHostAddresses((Get-AzureDeployment -ServiceName service_name).Url.DnsSafeHost) | foreach { $_.IPAddressToString }