Erwin Steffens
Erwin Steffens

Reputation: 57

Windows Azure get external dns for InstanceInputEndpoint

For our service we are using Azure InstanceInputEndpoints to directly connect to an instance. We can find the external port number through:

RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["end-point-name"].PublicIPEndpoint.Port

What we need is a way to find the external DNS name or ip-address which can be used to connect to this instance through the load balancer, but how can we find it? We need the correct name for production and staging environment. We prefer to get the DNS name like

our-service.cloudapp.net

Upvotes: 1

Views: 498

Answers (1)

kwill
kwill

Reputation: 10998

There is no way to get the DNS name from any sort of DNS lookup since Azure DNS does not supprt reverse lookups. And the service name is not saved in the service runtime.

The only way you can get the DNS name is to use the service management API from within your hosted service. There is an example at http://blogs.msdn.com/b/clouddeployments/archive/2010/05/12/making-calls-to-the-service-management-api-from-a-service-running-in-windows-azure.aspx, but it is a bit old. There are newer examples if you look around.

A couple suggestions:

  1. Why do you need the DNS name? Why not just use the IP address you get from the IP endpoint?
  2. Why are you using the cloudapp.net domain name to begin with? You should register your own domain name (ie. www.myapp.com) and set that as a CNAME to your cloudapp.net URL. Then you can make your calls to www.myapp.com: so that all you need to get from the endpoints collection is the port number.

Upvotes: 1

Related Questions