Is it possible to get the public virtual IP (VIP) of an azure service using powershell?
-
What do you need it for?René– René2013-06-03 10:39:32 +00:00Commented Jun 3, 2013 at 10:39
-
I need it because I want to set the cluster IP address using Set-ClusterParameter as in $CloudServiceIP in tutorial msdn.microsoft.com/en-us/library/windowsazure/dn376546.aspxBrian Leeming– Brian Leeming2013-10-07 17:55:59 +00:00Commented Oct 7, 2013 at 17:55
3 Answers
One approach would be to use the Get-AzureEndpoint command
Get-AzureVM -Name "thevmname" -ServiceName "theservicename" | Get-AzureEndpoint | select { $_.Vip }
3 Comments
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.
1 Comment
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