Link port to DNS name in Azure VM

JN 0 Reputation points
2024-03-19T13:43:50.4966667+00:00

Hi,

I have an Azure VM with DNS name of testing.southeastasia.cloudapp.azure.com which links to IP address of 52.157.189.61. How can I instead make it so that the DNS name links to a specific port in that IP address i.e. 52.157.189.61:8501?

Thanks

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
597 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,145 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,147 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jackson Martins 9,646 Reputation points MVP
    2024-03-19T13:49:48.7633333+00:00

    Hi JN

    To make your DNS name test.southeasia.cloudapp.azure.com point to a specific port (such as 8501) in your IP address, you will need to understand that DNS itself cannot directly associate domain names with ports. DNS was designed to resolve domain names to IP addresses. However, there are several approaches you can take to achieve the behavior you are looking for.

    You can configure a web server (like Nginx or Apache) to Reverse Proxy your VM to listen on the default HTTP (80) or HTTPS (443) port. This server can then redirect requests to your application running on a different port. For example, you can configure Nginx to redirect requests to 52.157.189.61:8501.

    https://learn.microsoft.com/pt-br/azure/partner-solutions/nginx/nginx-overview

    Azure Application Gateway or a Load Balancer can be used to route traffic arriving at a given DNS name (or IP) to any port you define. You would configure the DNS name to point to the Application Gateway or Load Balancer, and then configure rules within those services to route traffic to your application on the desired port.
    https://learn.microsoft.com/en-us/azure/application-gateway/quick-create-portal

    You can use Azure Firewall or another NSV to redirect traffic through the port, coming in on port 80 or 443 and redirecting to port 8501

    https://learn.microsoft.com/en-us/azure/firewall/tutorial-firewall-deploy-portal

    Get in touch if you need more help with this issue.

    --please don't forget to "[Accept the answer]" if the reply is helpful--