Private connection between Azure Web App and Database for MySQL

Uhmazing34 30 Reputation points
2023-04-25T12:40:24.79+00:00

Hello,

In Azure I created a new Azure Database for MySQL flexible server, with connectivity method "Private acces (VNet Integration)".

I have an existing Azure Web App that I want to use to connect it to the new Database MySQL server through private connection.

When I created the Azure DB MySQL server, I assigned it the existing VNet (the same one that the Web App uses) and assigned it an own subnet.
I also created a Private DNS zone. My question is, how can I configure it so that there is a private connection between the existing Web App and the newly created Database Server? Thank you in advance.

Azure Database for MySQL
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,111 Reputation points Microsoft Employee Moderator
    2023-04-26T18:36:53.05+00:00

    @Uhmazing34 ,

    As I understand from your scenario description that you are wanting to establish a private connection between your WebApp, both WebApp and Azure Database for MySQL are on the same VNET, with Private DNS zone.

    I understand you have mentioned, “assigned it an own subnet”. Just to clarify, are they both on same subnet or different?

    You now need to have subnet that is delegated to App Service Web App endpoint. You may create a new subnet in the same virtual network as the database server was created. Please see the doc steps.

    If you haven’t done this already, create a DNS record in the private DNS zone for the MySQL server.
    (You may do this by going to the "Private DNS zones" blade in the Azure portal. Create a new DNS record and specify the name of the MySQL server and the private IP address of the private endpoint.)

    Update the connection string for the Web App to use the private endpoint.
    (You may do this by updating the connection string in the Web App's configuration settings to use the private endpoint DNS name instead of the public DNS name)

    Your MySQL flexible server must be in a subnet that is delegated for MySQL flexible server use only.

     

    Please checkout these docs for more info:

     

    Kindly let us know how it goes, I’ll be happy to follow-up with you further.


Your answer

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