#Connecting to SQL Databse

1 messages · Page 1 of 1 (latest)

vernal egret
#

Hello, I am new to Cloud computing, but I am now trying to connect to my SQL database.

Initial Goal & Steps:
Problem: mobile app needed to securely connect to your Azure SQL Database from anywhere in the world.
Initial Solution: explored setting up a private endpoint to route traffic through an Azure Virtual Network (VNet), enhancing security and eliminating the need for public IP address management.

Steps Taken:
    Created a VNet.
    Created a private endpoint for your SQL server within the VNet.
    Configured the private DNS zone.

Issue right now: "pre-login handshake" error.

Surley there is a eaiser way? Its been close to 2 hours and still cant get access (I can if i add my ip adress to the public list).

I have set up Cosmo DB for another app with 0 issues at all.

Many thanks for the help!

fast pollen
#

Do you have a VPN connection to the VNET? @vernal egret

vernal egret
#

I dont' after futher searching, a VNet would work if i was connecting it to, which would not be even possible for this? Like if you were to download the app, the database needs to connect without throwing its toys

fast pollen
#

Well the point of a private endpoint is to avoid exposing the database to the internet. But it sounds like you actually want it to be publicly accessible?

#

Just ditch the private endpoint

vernal egret
#

Okay, got you, Sorry, still learning,

All i need to is for the database to be able to be query (i.e get some data about a product), so Public yea?

#

This is current set up, Will look for maybe another guide if this is not best pratice

fast pollen
#

You need to query the database from the internet, correct?

vernal egret
#

Yeah

fast pollen
#

I would just turn off the firewall rules then

vernal egret
#

Okay, this may be a stupid, question too, but for the connection string, im aware there is options, but I've picked the SQL authentication, and that string will be stored in azure valut. is that viable?

fast pollen
#

Is this for a school project?

vernal egret
#

No, for a rea life project for my CV,

near fiber
#

If I may, directly connecting from mobile app to DB is considered bad practice. You would require store db credentials in the app code. I would highly recommend considering creating a REST API infront of your db which your mobile app calls. If your REST API is hosted (Azure function or app service or container, w/e) it would be able to connect to the db through private endpoint while you expose your REST API to the public internet

#

If your mobile app would be only used by you it might be OK to try some things out

#

but if you would create a mobile app for the public to use please don't connect directly to the DB, people will find a way to mess with it

mossy tartan
near fiber
mossy tartan
#

ah ok so that sounds like a no

near fiber
#

Well it's your own decision in the end

#

But lets put it differently, what is the purpose of your portfolio?

mossy tartan
mossy tartan
near fiber
mossy tartan
#

I thought this project would be nice to have on my cv to make me standout. thats the only reason I am doing it tbh

near fiber
#

the backend is directly connected to the database

#

Lets say real booking apps

#

wether it's a web page or a mobile app they would never directly connect to the database

#

because people can just decompile their app or inspect their website and grab the database server and try to exploit it

#

While when the app/website is communicating to a REST api or any other sort of backend it would not have the server details exposed

mossy tartan
near fiber
#

yes

mossy tartan
mossy tartan
# near fiber

hmm so is the application swerver the server you create on azure?

near fiber
#

Yes

mossy tartan
#

and the web server is? what that be since It is an application I am making using QT

near fiber
#

A very possible architecture for a booking app could be:

A frontend hosted on azure web app, sending HTTP request to the REST API in an app service which can connect to a database in Azure SQL

#

I don't know what QT is, is it some framework to create desktop apps?

#

or mobile apps?

mossy tartan
#

believe u can do desktop and mobile

near fiber
#

In the end it doesn't really matter where the frontend/UI/client facing app is, wether it's an website, desktop app. mobile app

#

also backend doesnt necisserily has to be REST, can be websocket, graphql etc. you can choose what you want

mossy tartan
#

right ok well thx I was literally trying to do the code for connecting to the database with c++ but was getting errors so will look into the rest api maybe that might save me lol

near fiber
#

But REST will be the easiest IMO