Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the secret to connecting remotely to SQL Server running on a Google Cloud VM?

I have a Google Cloud VM running Windows Server 2016 Datacenter with SQL Server 2017 installed.

I am using SSMS 2017 as my client, both locally and remotely.

I can RDP to the VM.

I can ping the IP of the VM.

I disabled the firewall on the VM.

I set the database to allow SQL Server authentication.

The SQLBrowser service is running in the server.

There are firewall settings on the Google Dashboard and I opened ports 1433, 1434 TCP and UDP on the project, nothing changed.

I can connect to the SQL Server instance with the same credentials using the same client running locally on the VM.

When I run PortQry it tells me ports 1434 and 1433 are FILTERED even though the firewall is disabled. That confuses me, maybe I don't understand the output of PortQry.

enter image description here

I get this error when I use the server\instance to connect remotely: enter image description here

If I just use the server name I get this error: enter image description here

Here is the firewall setting:

enter image description here

like image 700
nicomp Avatar asked Feb 23 '18 20:02

nicomp


People also ask

How connect SQL instance from VM to GCP?

On your GCP Console, click on the Navigation Menu and Scroll down to Storage section and finally click SQL. You'll get a dialog box, go ahead and select Create Instance. Go ahead and input your desired Instance ID, Root Password and Zone.

Does Google Cloud support SQL Server?

SQL Server running on Google Cloud works with all of your familiar tools like SSMS and Visual Studio. Connect your existing workloads to the best of what Google Cloud has to offer.


2 Answers

I have the same problem with you. You should use the same Networks tags of your VM machine in the Firewall rules settings. Your VM machine tags Firewall rules Before, I set the targets to "Apply to all" and it didn't work. A little awkward!

like image 39
Khoa Avatar answered Oct 18 '22 23:10

Khoa


I had same issue and I overcome with following settings with following GCP Firewall rules.

There is no need to disable firewall in GCP VM instance, better keep it on. To access your instance using SQL server management studio within your GCP VM's external IP address, you also need to add it in GCP network firewall rules too.

Name, Type, Targets, Filters, Ports, Action, Priority, Network

rulename1, Ingress, Apply to all, IP ranges: gcp external IP here, all, Allow, 900, default (For GCP VMs External IP Address)

rulename2, Ingress, Apply to all, IP ranges: your remote IP here, tcp:1433, Allow, 900, default (For Remote Server or Development Server IP Address)

There is no need to allow Edge traversal at all.

Hope this will help someone.

like image 129
adaptable.services Avatar answered Oct 19 '22 01:10

adaptable.services