2

I am using this answer to look up our cloud service's public ip.

Azure Powershell: Get public virtual IP of service

This only returns the endpoints for the production cloud services. We also need to easily look up our staging cloud service endpoints.

Does anyone know how to look these up with Azure Powershell?

Thanks!

Community
  • 1
  • 1
TWilly
  • 4,863
  • 3
  • 43
  • 73

3 Answers3

7

Get-AzureDeployment and System.Net.Dns class will help.

Get-AzureDeployment -ServiceName your_service_name -Slot Staging

You will get lots of properties, including URL

Then you can run following PS command which will give you IP address (where your_url is usually XX.cloudapp.net) for the given domain name:

[System.Net.Dns]::GetHostAddresses("your_url") | foreach {echo $_.IPAddressToString }

I hope that will help.

Tom
  • 26,212
  • 21
  • 100
  • 111
  • 1
    Thanks for the quick response. I accepted @astaykov's answer since he included the -instanceDetail flag which returns ip info which you can parse. – TWilly Dec 19 '13 at 23:31
5

This is one-liner and uses nothing other then Get-AzureDeployment - and returs directly the VIP, as long as you have at least one InputEndpoint defined - otherwise you can't connect to the service anyway ;) No need of heavy lifting or using DNS client ...

PS C:\> Get-AzureRole -ServiceName "your_service_name" -Slot "staging" -InstanceDetails -RoleName "your_desired_role_name_when_you_have_more_than_one_role" | select {$_.InstanceEndpoints[0].VIP }

And you will get the VIP. The important option here is -InstanceDetails which will get the Endpoints.

astaykov
  • 30,768
  • 3
  • 70
  • 86
0

Here is the simplest answer I could think of. It returns a string containing the VIP of the service in the slot you specify.

PS C:\> (Get-AzureDeployment -ServiceName 'ServiceName' -Slot Staging).VirtualIPs.Address
Ryan
  • 121
  • 1
  • 6