10

Is it possible to get the public virtual IP (VIP) of an azure service using powershell?

Christian Genne
  • 101
  • 1
  • 4

3 Answers3

8

One approach would be to use the Get-AzureEndpoint command

Get-AzureVM -Name "thevmname" -ServiceName "theservicename" | Get-AzureEndpoint | select { $_.Vip }
Mike Asdf
  • 2,309
  • 26
  • 34
  • 1
    In my case the server has 4 endpoints so this returns 4 records with identical IPs – Brian Leeming Oct 07 '13 at 17:53
  • Do you know how to get the IP for a staging environment in a cloud service? This is only returning the production endpoints. – TWilly Dec 19 '13 at 18:59
  • If you want to get IP of both staging and production cloud services, you can use the powershell command in this answer... http://stackoverflow.com/questions/20690307/azure-powershell-get-public-ip-of-staging-cloud-service/20691598?noredirect=1#20691598 – TWilly Dec 19 '13 at 23:33
1

I'm not sure, but I doubt there is an easy way, because it might change (although it rarely does).

Windows Azure provides a friendly DNS name like “blogsmarx.cloudapp.net” or “botomatic.cloudapp.net.” There’s a reason for providing these (other than simply being prettier than an IP address). These are a necessary abstraction layer that lets the Virtual IP addresses (VIPs) underneath change without disrupting your service. It’s rare for the VIP of an application to change, but particularly thinking ahead to geo-location scenarios, it’s important that Windows Azure reserves the right to change the VIP. The friendly DNS entries provide a consistent interface for users to get to your application.

Source: http://blog.smarx.com/posts/custom-domain-names-in-windows-azure

However, if you get the dns name you could do a dns lookup.

lightbricko
  • 2,649
  • 15
  • 21
  • 1
    Fortunately that information is out-of-date. VIP will stay in place for nearly every update now, except as noted in [this article](http://blogs.msdn.com/b/windowsazure/archive/2011/10/19/announcing-improved-in-place-updates.aspx). – David Makogon Oct 07 '13 at 22:42
1

To obtain the Virtual IP of an Azure CloudService deployment via powershell, you can use the Get-AzureService cmdlet combined with the Get-AzureDeployment cmdlet like this:

(Get-AzureService -ServiceName "myCloudService" `
   | Get-AzureDeployment -Slot Production).VirtualIPs[0].Address

(Just assign the previous command to, e.g., $CloudServiceIp to plug the IP into subsequent commands.)

You can also get a list of all cloud services and virtual IPs for your subscription by running the following:

Get-AzureService | Select-Object -Property ServiceName, `
   @{Name='ProdIP';Expression={(Get-AzureDeployment -Slot Production `
   -ServiceName $_.ServiceName).VirtualIPs[0].Address}} | Format-Table -AutoSize
Dusty
  • 3,946
  • 2
  • 27
  • 41