TWilly
TWilly

Reputation: 4933

Azure Powershell Get Public IP of Staging Cloud Service

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!

Upvotes: 2

Views: 2008

Answers (3)

Ryan
Ryan

Reputation: 141

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

Upvotes: 0

astaykov
astaykov

Reputation: 30903

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.

Upvotes: 5

Tom
Tom

Reputation: 26819

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.

Upvotes: 7

Related Questions