Azure web app connection to azure sql fails? - azure

I Created a Web App,
Ive setup a Azure sql server with a private endpoint
Created a Azure SQL database on the above sql server
Created an endpoint for SQL server database and added firewall rule
to allow azure services through, also added vnet where private
endpoint is on to the firewall
However when i try to tcpping to the azure sql database from the console of the web app, i keep getting connection failed?
Any ideas?

ok it seems you need to append :1433 at the end of the tcpping otherwise it wont work! Go to your web app console and type the below in substitute the "adbsql01" with your sqlservername
eg
tcpping adbsql01.database.windows.net:1433

Related

Access DB from .NET Core Web API deployed as Azure Web App

Problem:
We have a .NET Core Web API that we have just deployed as an Azure Web App. Testing locally everything works fine, however we are unable to connect to our DB from the deployed API in Azure.
From Application Insights I can see we are getting the following error:
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.
Our setup:
We have our connection string included in appsettings.json
"ConnectionStrings": {
"DefaultConnection": "Data Source=<source>.com,<port>;Initial Catalog=<db>;User ID=<username>;Password=<password>;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;"
},
We know our API is using this connections string because we can see in Application Insights that there is a timeout connecting to the db specified in that exact connection string.
We do not have access to DB configuration as we have read only access granted to us from a third party. We can connect via SSMS/Azure Data Studio and when testing our Web API locally (which makes us think the connection string is correct).
Other Posts we have Referenced:
Connection String in Azure Web App Configuration - I have tried including and not including our connection string from the Azure App Service Configuration - neither changed that we got a timeout and subsequent 500 error.
Include Connection String in appsettings.json - We have our connection string included in appsettings.json and testing locally, we can connect to the db without issue.
Improperly Formatted Connection String - The connection string works when testing locally, so we do not believe it to be an issue with the formatting of the connection string. Additionally, because Application Insights says that there is a timeout connecting to the DB specified in the connection string, it appears to be using the connection string we are providing.
Any ideas as to what might be going on here and how we can connect to the DB would be greatly appreciated.
In this case, we needed to request that the third party whitelist our Azure Web Apps Outbound IP's.
Your Azure Web App Outbound IP's can be located in a number of ways.
Via Azure Portal
Web Apps > Your Web App > Under "Settings" go to Networking > Outbound Addresses
Via Azure CLI
az webapp show -n yourwebappname -g yourresoucegroup --query "outboundIpAddresses"

Cannot connect to SQL Server from logic app

I'm having trouble connecting to my SQL Server in an Azure Logic App.
I've just created a fresh SQL Server and database and am now attempting to connect to it in my logic app. However, it doesn't appear to be showing when I enter my credentials. I've been following this tutorial.
Does anyone know why this might be the case? Is it perhaps a permission thing that I may have missed?
I've also found that if i do an AD connection, I get this:
Try this for connecting to your DB:
first of all, try to connect with Azure AD Integrated here, and if you don't see your SQL Server and DB in the list try the next step
go to Resource Group where you created LogicApp and find the connection name that you used when trying to connect with Azure AD Integrated. You need to open it and click on Edit API Connection. In Authentication Type use SQL Server Authentication and other data to connect to your DB here.
Make sure you are allowing azure services to access your database server at
SQL Server > Firewalls and virtual networks > Allow Azure services and resources to access this server = Yes

Azure Logic App - Access SQL Server running in Azure VM

My client has a SQL Server instance installed on an Azure VM.
I am building an Azure Logic App and the end result is to write to this SQL Server instance.
To connect to this SQL Server instance running on the Azure VM do I need to treat it the same way I would as an on-prem SQL Server and install the gateway softwaare, or is there a better way since the VM is in Azure?
You shouldn't need to use a gateway. A gateway is mainly used for securing the data connection from a cloud service to an on-prem datbase, since the traffic goes over the public internet.
With the DB on an Azure VM, you can deploy your logic app into an integrated service environment. This keeps the traffic between logic app and DB on the private VNET. See the documentation on ISEs here.

How to connect Azure App Service Web App to Google SQL Server Database?

Due to what is happening right now in the world, azure seems to have run out of space. Currently, you cannot create a new SQL Server therefor no SQL Databases. Does anyone have experience or knowledge on how to Connect the Web App hosted on Azure to the GoogleSQL SQL Server? It's the only viable cloud service I found that can be free for some time until azure is back online. I cant figure out how to get the connection strings and how to allow connections etc. There is minimal documentation on SQL Server from googles side.
Thank you in advance,
Mike
For connect to Cloud SQL you need to enable the Public IP of your database and whitelist the Public IP of your Azure app to Allow connections between Azure app and Cloud SQL
The only way to connect to Cloud SQL from the external services is via IP connection in this document is explained step by step how to enable Public IP for your SQL server and how to whitelist the incoming IP addresses.
I found this article about how to create a connection string using public IP

How to enable the access to Azure services in my AZURE SQL database server?

I'm trying to create a "Integration Runtime" (AZURE-SSIS type) in my data factory. (To run my SSIS packages in cloud) I already have a virtual machine (Azure SQL data base server Up and running).
While during the IR creation process I'm not able to link my AZURE SQL database SSISDB catalog to "Catalog database server endpoint" (OR) the server is not showing up in the drop down box.
In the MSDN blog it says
"Confirm that the **Allow access to Azure services** setting is enabled for the database server. This is not applicable when you use Azure SQL Database with virtual network service endpoints/Managed Instance to host SSISDB."
Could anyone know how to enable this feature ? I hope by enabling this feature I can link my server in the IR and run the packages in the cloud.
Thanks
To allow applications from Azure to connect to your Azure SQL server,
Azure connections must be enabled. When an application from Azure
attempts to connect to your database server, the firewall verifies
that Azure connections are allowed. A firewall setting with starting
and ending address equal to 0.0.0.0 indicates Azure connections are
allowed. If the connection attempt is not allowed, the request does
not reach the Azure SQL Database server.
you can do it any way, powershell, az cli, arm templates. if you go to the portal to the firewall blade, there would be a button to do that.
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure
Please take a look where is located on below image.
On this documentation you will have instructions how to reach that screen.

Resources