How can I connect an Azure application using Windows Authentication to onpremise SQL DB - sql

How can I connect an Azure application using Windows Authentication to onpremise SQL DB.
I have a site to site connection established to a machine now I want to create an application using Windows Authentication and connect to on premise SQL DB and do all the DML operations.
How can I achieve this.
Thanks in Advance.
Regards,
Suresh

Related

How to configure Azure AD in SQL Server for authentication?

We need to configure Azure SQL server with Azure AD such that while connecting to Azure SQL server through JDBC our users should be able to use their AD username and password.
We are unable to find documentations on how to setup Azure AD with Azure SQL server.
We are looking for some documentation or some steps to configure Azure AD with Azure SQL server.
Firstly, while creating the Azure SQL Server, you need to make sure to choose Use only Azure Active Directory (Azure AD) Authentication in Authentication method option.
The JDBC driver allows you to specify your Azure Active Directory
credentials in the JDBC connection string to connect to Azure SQL
Database.
To know how to configure Azure Active Directory authentication visit Microsoft official document Connecting to SQL Database By Using Azure Active Directory Authentication.
To connect the Azure SQL Database with Azure AD through JDBC, there is a proper setup required in which you need to install and configure some prerequisites. This official document from Microsoft will guide you to do same.

OLDB connection string to connect Cloud SQL db

I am looking for the connection string to connect to SQL server on Azure Cloud
used below string to connect to SQL user
OLEDB;Provider=SQLOLEDB;Data Source=#DATASOURCE#;Initial Catalog=#CATALOG#;UID=userid;Password=pwd;
this is working fine. but when I try connecting with windows user I need to update the connection string as
ODBC;Driver={ODBC Driver 17 for SQL Server};Provider=SQLOLEDB;Data Source=#DATASOURCE#;Initial Catalog=#CATALOG#;Encrypt=yes;TrustServerCertificate=no;Authentication=ActiveDirectoryInteractive;UID=myemailid
Is there a way I can use OLEDB driver to connect using windows authentication?
thanks in advance for help
No, we can't. Azure SQL database doesn't support Windows authentication for now.
Azure SQL Database only supports two types of authentication: SQL Authentication and Azure Active Directory Authentication.
No matter which driver you use to connect the Azure SQL database, the windows authentication won't work.
For more details, please ref this document: Authorize database access to SQL Database, SQL Managed Instance, and Azure Synapse Analytics

Connecting web app to SQL Server on Azure VM

I have a SQL Server on Azure VM and I am trying to connect to it from my web app. Can someone point me in the right direction?
I have searched and I have not found one where it connecting to SQL on VM (iAAS). I have only seen tutorials connect to the SQL Server (PAAS). Any help appreciated.
SQL Server on an Azure VM is exactly the same as connecting to SQL Server on a physical server or a VMWare VM.
You will need to ensure that the VM has either a static IP Address or a DNS name. This is what you would use to connect to it from your client. You will also have to ensure that you deal with firewalls.
Is your client also an Azure VM or is it on-premises?
Here's two Azure documents may help you:
Connect to a SQL Server Virtual Machine on Azure.
This topic describes how to connect to your SQL Server instance running on an Azure virtual machine.
Connect your application to Azure SQL Database managed instance.
Today you have multiple choices when deciding how and where you host your application.Whatever choice you made, you can connect it to a Managed Instance.
Hope this helps.

How to Connect to OnPremise SQL Server from SSMS in Azure VM usign Hybrid Connection Manager

This question is bit on the Reverse Side of Connecting via SSMS from Azure VM to on premise SQL Server.
Can Hybrid connection Manager be used to configure connectivity between Onpremise and Azure such that i can use SSMS from Azure VM to connect to OnPremise SQL Server?
I don't think you can use Hybrid connection Manager to connect between On-premise and Azure network. As far as I know, the HCM is a relay agent and included in a partition of hybrid connection feature. The hybrid connection feature consists of two outbound calls to Azure Service Bus Relay.
For example, if you want web apps in the app service to access the DB in the on-premise network. There is a connection from a library on the host where your app is running in App Service. There is also a connection from the HCM to Service Bus Relay. See how it works. Also, The new Hybrid Connections capability of Relay is a secure, open-protocol evolution based on HTTP and WebSockets. In this case, you could not create a Hybrid Connection from Azure VM to Service Bus Relay via SSMS.
So, If you want to connect the on-premise SQL server from Azure VM via SSMS, you need to set up a VPN connection between Azure and your on-premise network. Read more details about VPN gateway.

PowerBI using AD

I am trying connect to Azure SQL database with PowerBI using AD Authentication. Basically we want users of the PowerBI report to use their own AD credentials when they connect to the database.
Using windows authentication I can connect to the Azure SQL via SSMS. But when I try the exact same way via PowerBI its says "user was not authorized"
I have on Azure SQL Server created a AD user (FROM EXTERNAL) that is my AD User.
Am I missing something?
Please ensure firewall rules for the SQL Azure database are configured to "Allow access to Azure services".
Currently Power BI doesn’t support AAD authentication when connecting to Azure SQL Database, but using Microsoft ODBC Driver 13 it is possible to do it as explained here.
ODBC (for AD PW Auth; must have ODBC Drive 13 for SQL Server)
Driver={ODBC Driver 13 for SQL Server};Server=<servernamehere>;Database=<databasenamehere>;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;Authentication=ActiveDirectoryPassword