Azure : How to import a sql file into the private database linked to a php app service web app ?

Pierre Fleutot 0 Reputation points
2023-09-08T14:19:55.2266667+00:00

Hi,

I am new to Azure and opened up a test account to train before deploying a Symfony php app into App services for a customer.

My app is running and it's connected to the database.

Now I need to fill up the database using a sql file. I usually use a SQL GUI (generally Heidi Sql or phpmyadmin) to manage databases, but I cannot connect to the database from my local machine. I think the App Services database is not accessible from the internet, so how can I do ?

This is what I see on the portal :azure_db

It says "only resources form vnet or net paired to your server have access".

Should I try to access it from the internet in some way or is it impossible and in that case should I use an Azure online tool to manage the database ?

Thanks for your insights.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,823 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,779 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tushar Kumar 3,326 Reputation points MVP
    2023-09-09T00:03:53.4566667+00:00

    Hi,

    Thanks for asking your question!.

    You can use the below option and just click on Add client IP it will allow from your PC to DB access .

    User's image


  2. ajkuma 26,136 Reputation points Microsoft Employee
    2023-09-11T18:07:18.96+00:00

    @Pierre Fleutot Following-up on this, it's great to hear that you are exploring Azure and planning to deploy a Symfony PHP app into App Services.

    Based on my understanding of your scenario and as you have mentioned, the App Services database is not accessible from the internet.

    You may connect to the app container directly from your local development machine using SSH, SFTP -New-SSH-Experience-and-Remote-Debugging-for-Linux-Web-Apps.html

    You may try these steps to import a SQL file :

    1.    Open the Azure portal and navigate to your App Service web app.

    2.    Click on the "Configuration" tab and then click on "Connection strings".

    3.    Add a new connection string with the following details.

    • Name: Any name you want to give to the connection string.
    • Value: The connection string for your database. You can find this in the "Properties" section of your database server in the Azure portal.
    • Type: Choose SQLServer".

    4.    Save the connection string.

    5.    Now, Under the "Development Tools" tab and click on "Advanced Tools".

    6.    Click on "Go" to open the Kudu console.

    7.    In the Kudu console, click on "Debug console" and then click on "CMD".

    8.    Navigate to the "site" folder and create a new folder called "data". (as required)

    9.    Upload your SQL file to the "data" folder via FTP

    10.  With an FTP client, you may copy files directly into /home/site/wwwroot 

     

    Reference: Can I use Secure Shell (SSH) to connect to the app container virtual machine (VM)?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.