How do I use the default 'Internal Azure DNS' to resolve DNS names of worker roles within the same Azure Virtual Network? - azure

I have a cloud service that has a worker role 'Kernel' with 2 instances (instance 0, and instance 1). I have another VM deployed in a different subnet, in the same Azure Virtual Network. I heard that I can use Azure DNS to resolve a hostname to get the private (dynamic) IP address of each worker role. But how do I actually do that? I assume on the client side this is just a standard DNS lookup, so the question is really: what do I put in the CSCFG file, and what FQDN DNS name is actually what I should resolve?

To set the name on the worker role VMs, add vmName to the cscfg as described here: https://msdn.microsoft.com/en-us/library/azure/jj156212.aspx
The two workers will have a common DNS suffix so you can just refer to them by name. To find the FQDN you'll either need to login to one of the VMs and do ipconfig /all or use the powershell Get-AzureVM cmdlet with the -Debug switch and look for InternalDnsSuffix.
Regards
Gareth [MSFT]

Related

Azure Container Instance - dns and subnet in the same container

I have an Azure Container Instance with subnet configuration (I need to access an internal service). But I also need to configure dns.
I try to create the Container, but it returns this message: The IP address type can not be public when the network profile is set.
Is it possible to configure dns and configure the subnet in the same container?
Unfortunately, if you deploy the Azure Container Instances in the Subnet of a Vnet, then you cannot set the public IPs or DNS for it. Azure does not support it, at least now. Maybe it will be supported in the future. For more details, see Virtual network deployment limitations.
Container groups deployed to a virtual network do not currently
support public IP addresses or DNS name labels.
Hope this will help you.
The error with the network profile looks like a bug in the az
command tool. If you just specify your VNET name and subnet name
then it will create a network profile name.
If you want to use DNS
to resolve these names you'll need to setup DNS separately, and call
an additional az command to configure the DNS after you create the
container instance.
az network dns record-set a add-record ...
See this doc for using Azure DNS with private IP addresses.
Use Azure DNS for private domains

How Do I Resolve A Public DNS Name To An Internal IP On Azure?

I have an azure network set up with the default Azure DNS.
All the VMs are ubuntu.
When I try to access another VM on the network via the public DNS name it resolves to the public IP.
How do I make it resolve to the internal IP when I request it from the virtual network (and obviously still resolve to the public IP when requested externally).
I'm interested in cli answers as well as configurations through the portal.
Azure DNS for IaaS and PaaS solutions
Please see this article for more information on Azure's own DNS service associated with virtual networks. In short
When role instances and VMs hosted in Azure need to resolve domain
names to internal IP addresses, they can use one of two methods:
Azure-provided name resolution
Name resolution that uses your own DNS server (which might forward queries to the Azure-provided DNS servers)
The type of name resolution you use depends on how your VMs and role
instances need to communicate with each other.
Azure DNS Private Zones (in preview)
There's also a relatively new service called, Azure DNS Private Zones that allow you to set up a private DNS service to be used with, for example virtual networks.
This service allows you to set up a private domain and private IPs for your machines. See this page for more information and some common usage scenarios.
Also, see this this feature suggestion:
Enable split DNS for providing both public and internal name resolution to VMs in the VNET

Azure VMSS : Retrieve FQDN

I have created a Virtual machine scale set in Azure and now require to access FQDN of instance from inside of VM. Tried these:
1. Using Azure metadata service. It surprisingly does not have FQDN field.
2. used Hostname -f it gave an fqdn but I think it is to be used internally in azure as it is not accessible from outside.
3. Tried listing public IP of VMSS but how to filter it to show public ip related my VM escapes me.
Update : In AWS "curl http://169.254.169.254/latest/meta-data/public-hostname" commands give the intended output. I am looking for its equivalent
For now, it's not possible to get FQDN from metadata server.
More information about data categories are available through the Instance Metadata Service, please refer to this link.
Does your VMSS instances create with public IP addresses? if yes, you can use Powershell or Azure portal to find the FQDN.

Assign VNet IP address to Azure Cloud Service

I have an Azure Cloud Service, and a Azure Virtual Network with Subnet.
I can deploy the Cloud Service onto the Virtual Network by setting the appropriate configuration setting in the .cscfg.
What I'm struggling with though is bringing the role onto a specific IP address. My guess is that it's currently using DHCP to get an IP address.
I've tried using the following Powershell:
Get-AzureVM -ServiceName myrole | Set-AzureStaticVNetIP -IPAddress 127.16.0.4 | Update-AzureVM
But the IP address never changes:
<IpAddress>172.16.0.5</IpAddress>
Is there a restriction on doing this on cloud services?
Any help would be really appreciated.
Thanks,
Graeme
Network configuration schema for Cloud Service is documented here.
https://msdn.microsoft.com/library/azure/jj156091.aspx
As you'll see, you have the ability to specify a ReservedIP but not a static private IP.
My understanding is that Set-AzureStaticVNetIP works for Azure IaaS VM, not for Cloud Service VM.
Virtual machines whether there are IaaS or Paas provisioned in a VNET are always allocated the first available IP address in the subnet after the first 4 addresses which are reserved from .0 to .3.
So considering your request, I will define subnets that enable to target the right subnet IPs for my role instances, and if I need to precisely know which IP is used by which instance, read it in the "role start" method and use it to configure whatever solution you need for this IP to be be "static".
Hope this helps
Best regards
Stéphane

FQDN on Azure Virtual Machine

I'm curious if the FQDN is persistent on Virtual Machines in Azure and if anyone could post an example how this would look.
Ie myhost-abc.vm.windows.net
By persistent I mean it will always be the same, never to be changed.
Connect to your virtual machine with Remote Desktop (RDP)
Open a command prompt
Type this command: hostname (to show the name of the machine)
Type this command: nslookup "MACHINE_NAME" (where "MACHINE_NAME" is the obtained during the previous step)
The result show Name (FQDN) and address, in my case: MYSERVER.MYDOMAIN.f5.internal.cloudapp.net is always the same.
When you create a Windows Azure Virtual Machine (or Windows Azure Cloud Service) you first select a name for your service and based on your service name a DNS name is assigned to you. So example you have choosen service name ( with both VM or CS) "myservice" your DNS name will be and will remain same forever as long as you delete this service:
http://myservice.cloudapp.net
Now when create a Virtual Machine in service (or deploy your cloud application to this cloud service) you will have a VIP (external facing) assigned to your service and depend on your service endpoint configuration your service will interact to externally. These IP address will stay same as long as you do not delete the virtual machine(s) or deployment.
Also you can use CNAME setting (or DNS record) to route www.myservice.com calls to myservice.cloudapp.net this way if you change myservice to myservice1 by any reason, after setting proper CNAME your www.myservice.com call still go to your Azure service (VM or CS).
http://www.myservice.com ==>> http://myservice.cloudapp.net or http://myservice1.cloudapp.net
As you can see it does not matter if you choose myservice or myservice1 as service name, by setting proper CNAME/DNS setting you can route your actual DNS to Azure Service.
Just an addition. For Linux, do:
nslookup "$(hostname)"

Resources