Azure VM Issue

Anonymous
2023-03-01T12:20:21.8466667+00:00

Hi Team,

I have installed SQL Express edition on one of azure VM machine ,

need to connect it from my local machine , could any one provide the steps to do it and access particular db from VM from my local machine . This is one problem

and another one is how to access local sql server to Azure VM is also another way needed here could any one guide me

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
{count} votes

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 129.5K Reputation points MVP Volunteer Moderator
    2023-03-01T12:49:18.2966667+00:00

    Hi @Jayaprakash Pulugovinda ,

    there are different options to connect to an Azure VM from your lokal computer:

    One option is to use a public IP on the VM and connect via RDP with the Azure VM

    https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/associate-public-ip-address-vm

    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/connect-rdp

    Second option is to use a Site2Site or Point2Site VPN to get access.

    https://learn.microsoft.com/en-us/azure/vpn-gateway/point-to-site-about

    https://learn.microsoft.com/en-us/azure/vpn-gateway/tutorial-site-to-site-portal

    First option is less secure but cheaper.

    The second option is more secure but more expensive.


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    0 comments No comments

  2. vipullag-MSFT 26,522 Reputation points Moderator
    2023-03-02T04:53:54.0866667+00:00

    Hello Jayaprakash Pulugovinda

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    As Andreas mentioned in the previous response, you need to have Public IP with SQL port on NSG open to access from local machine.

    For your ask on How to connect to SQL Server on an Azure VM from your local machine?

    -Make sure the Azure VM on which you installed SQL has a public IP associated to it. You can check this in the Azure portal by navigating to your VM's "Networking" settings.
    User's image

    -On the NSG make sure the port that SQL Server is using (by default, port 1433) is open in "Inbound port rules" of NSG, if not adding a new rule for port 1433 will allow access on the port.

    -On your local machine, open SQL Server Management Studio and click "Connect". In the "Connect to Server" window, select "Database Engine" as the Server type, and enter the public IP address of your Azure VM in the "Server name" field, followed by a comma and the port number (e.g. "27..45.98.09,1433").

    Please Note, incase of your Azure VM is configured to use Windows Authentication, select "Windows Authentication" as the Authentication method and click "Connect". If your Azure VM is configured to use SQL Server Authentication, select "SQL Server Authentication" as the Authentication method, enter your SQL Server credentials, and click "Connect".

    For your ask on vice versa: How to connect to a local SQL Server instance from an Azure VM?
    -Make sure that the local SQL Server instance you have configured allows remote connections. In SQL Server Management Studio by navigating to the "SQL Server Network Configuration" section of the server properties, and enabling the "TCP/IP" protocol.

    -Open the port that SQL Server is using (by default, port 1433) in your local machine's firewall.

    -Now that the local machine configuration is done, in Azure VM, open SQL Server Management Studio and click "Connect". In the "Connect to Server" window, select "Database Engine" as the Server type, and enter the public IP address of your local machine in the "Server name" field, followed by a comma and the port number (e.g. "22.45.77.99,1433").

    Please select the Authentication methods appropriately as mentioned in the previous Note.

    Hope this helps.

    If the suggested response helped you resolve your issue, please 'Accept as answer', so that it can help others in the community looking for help on similar topics.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.