New Linked Service (Azure SQL Database) Test connection failed - azure-sql-database

I'm creating New Linked Service that would allow connecting to PaaS DB but the Test Connection is failing. Things I've checked are:
-Firewall on Logical VM for PaaS DB(Relevant IP are in place)
-Connect to PaaS DB via SSMS(It Works)
-Typos
I've used AutoResolveIntegrationRuntime since DB is in the same RG as the Azure DataFactory. Google didn't help much.
Regards
PS: More info can be provided if needed.

Firstly, make sure you have opened the "Allow access to Azure Service" in firewall setting.
What's your PSSA DB, single database or managed instance?
For single database:
The important thing you need to know that:
For managed instance:
To use copy data from an Azure SQL Database Managed Instance that's located in a virtual network, set up a self-hosted integration runtime that can access the database. For more information, see Self-hosted integration runtime.
If you provision your self-hosted integration runtime in the same virtual network as your managed instance, make sure that your integration runtime machine is in a different subnet than your managed instance. If you provision your self-hosted integration runtime in a different virtual network than your managed instance, you can use either a virtual network peering or virtual network to virtual network connection. For more information, see Connect your application to Azure SQL Database Managed Instance.
Here an tutorial can helps you: Azure SQL Managed Instances and Azure Data Factory: a walk-through.
Hope this helps.

Related

Copy Data From On-Premise SQL Server To Azure SQL - Azure Private Network

Requirement: I wanted to copy data from a specific table/view residing on a on-premise SQL Server to Azure SQL DB.
Infrastructure: As depicted in below picture. Essentially, the Azure network is directly connected with corporate network over Express Route. Thus it's a pure private network connection; as good as the corporate network itself.
Issue/Question: I know there are multiple approaches present to get this operation done and I am not restricted to use ADF copy Data tool only. BUT, for all of these I see some cavets or extra steps needed to be done as below:
ADF Copy Data Tool: Needs a SH-IR and a small MSI package needs to be installed on on-premise machine which hosts the SQL server for registration purpose.
Logic Apps: Needs a Virtual Gateway (OR) ASE
App Service: If the operation is wrapped in a C# application and I choose to deploy to a Azure Web Apps. Then in-order to connect to on-premise SQL Server we need to setup hybrid connection manager and as in #1 we need to install something in on-premise machine.
For my case, none of these extra steps can be done. essentially, the on-premise SQL Server comes under a different BU and thus I don't have any permission there; except they have given grant to a table/view. Thus, none of these extra shitty steps can be done.
Moreover, as mentioned above; since it's connected over express route as direct connection, As can be seen in above picture, both the on-premise and azure SQL are essentially inside the same corporate network. THUS, I should be able to access them directly without configuring any of these extra steps as mentioned above.
Please confirm on these and provide a suggestion.
Thank You.
You can still go with the ADF scenario without a SHIR by creating ADF in a Managed VNET using Private Endpoint. As you already have an ER circuit and have the flexibility to configure the Azure side, can you do this with Azure IR: Access on-premises SQL Server from Data Factory Managed VNet using Private Endpoint - Azure Data Factory | Microsoft Docs
There are 2 solutions which could work for your scenario but even for them to work ,you would need access to on prem SQL server machine access to some extent atleast for one time config and Azure SQL db should be accessible via SSMS installed on on-prem machine.
Using linked server
You can create a linked server ( process explained here https://www.sqlshack.com/create-linked-server-azure-sql-database/ ) on on-prem server and create a agent server job to insert data to azure SQL db table.
Via Python Script
This would need Python installation on on-prem machine. Once installed you can write script to transfer data between on-prem SQL server and Azure SQL db. You can schedule this script again by using an agent server job.

Azure SQL Network Firewall & Private Endpoint

I have a requirement in my project to pipeline the data from Azure Storage to Azure SQL database. We are using Azure Data Factory (ADF) V2 to perform this pipelining work.
In order to have secure access to Azure SQL DB, I have configured the following properties first.
Deny public network access: No
Connection Policy: Default
Allow Azure services and resources to access this server: No
With the aforementioned settings, the firewall rules have been configured to whitelist a few Public IPs and Virtual Network subnets.
This setting works fine when I use a DB client like SSMS inside a Virtual Machine (part of the subnet already whitelisted). However, it doesn't work when I am trying to create the linked service from ADF. I don't want to turn on this feature "Allow Azure services and resources to access this server" due to security risk to allow ADF connect to the DB. Instead, I have created a Private Endpoint from ADF to SQL Database and approved it but still kept "Deny public network access" --> No.
With the above setup, I have entered into an issue. i.e. The VM which has been successfully connecting to the DB Server doesn't connect to the database server now after enabling Private Endpoint for ADF.
Question:
May I please check what's wrong with this setup? According to MS documentation,
When "Deny public network access" setting is No (default), customers can connect by using either public endpoints (with IP-based firewall rules or with virtual-network-based firewall rules) or private endpoints (by using Azure Private Link), as outlined in the network access overview.
https://learn.microsoft.com/en-us/azure/azure-sql/database/connectivity-settings
I have configured Private Endpoint for ADF and VNet firewall for public endpoint access through DB client from a VM. But, only one works at time. To make VM client connect to the DB, I had to delete Private Endpoint of ADF whereas to make ADF work, I had to enable private endpoint which disables the DB connectivity from the VM.
Once you enable private end point for SQL then public network access stops working. Hence, that is the reason you are unable to connect from VM. Kindly consider using private end point to connect from your VM as well.
Now, Add both the (ADF and VM ) subnets to the SQL Server >> Firewalls & Networks >> Under the Add existing virtual Network
Create a private Endpoint in the Azure Data factory having the same subnet as the VM.
Hence, Could add the Azure SQL DB as a linked service in Azure Data Factory:
Here is my MyVNET where I have the created the Subnet(VM) and ADFSubnet which has been added to SQL DB existing Virtual networks via which it can be connected to the ADF or with the VM.
Hence, if you create 2 private endpoints for respective services in the same managed Virtual network you will be able to connect.

Connection to IaaS DB via ADF

We have an Azure IaaS database from which we want to copy data via ADF.
For that we are currently using Self hosted IR but since the DB is hosted on an Azure VM itself isn't it possible to directly communicate between ADF and IaaS DB with out IR(By whitelisting some IP or opening some port)
I think you should open some port, otherwise the self-hosted integration runtime can't access the Azure SQL database directly.
According to this post, if your firewall does not allow outbound port 1433. In this case, you can use a staged copy to Azure SQL Database. In this scenario, you would require only HTTPS (port 443) for the data movement.

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.

Error while creating Azure IR:Check the linked service configuration is correct

Error while creating an Azure IR data factory.
Cannot connect to SQL Database:
'mysqlserversowmya.database.windows.net', Database: 'master', User:
'adminuser'. Check the linked service configuration is correct, and
make sure the SQL Database firewall allows the integration runtime to
access.
Make sure you have open the SQL database firewall: add client ip and Allow Azure services and resources to access this server On portal:
To see: Server-level IP firewall rules
Hope this helps.