Christian Genne
Christian Genne

Reputation: 101

Azure Powershell: Get public virtual IP of service

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

Upvotes: 10

Views: 7083

Answers (3)

Dusty
Dusty

Reputation: 3961

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

Upvotes: 1

Mike Asdf
Mike Asdf

Reputation: 2319

One approach would be to use the Get-AzureEndpoint command

Get-AzureVM -Name "thevmname" -ServiceName "theservicename" | Get-AzureEndpoint | select { $_.Vip }

Upvotes: 8

lightbricko
lightbricko

Reputation: 2709

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.

Upvotes: 1

Related Questions