Unable to Create Service Connector Between Azure Function App and MySQL Flexible Server in VNet

Ofek Waiz 0 Reputation points
2024-11-27T08:15:11.1933333+00:00

Hello,

I'm trying to set up a service connector between an Azure Function App and a MySQL Flexible Server, but I’m encountering difficulties because the database server is within a Virtual Network (VNet).

Steps Tried:

Used the Azure CLI command:

bash

az extension add --name serviceconnector-passwordless --upgrade
az functionapp connection create mysql-flexible --connection <connection-name> --source-id <function-app-resource-id> --target-id <mysql-resource-id> --client-type nodejs --system-identity  

However, I received this error:

"Service principal 'systemAssignedIdentity' doesn't exist"

Attempted to use a containerized app within the same VNet to execute the CLI command but encountered similar issues.

Tried creating the connector via the Azure Portal, but it reported:

"The database server is in Virtual Network and Cloud Shell can't connect to it."

Question:

How can I connect to the VNet from my local environment or any other environment and execute the Azure CLI command to set up the service connector? Is there an Azure API or a recommended method to achieve this without needing to use a containerized function app?

Any guidance would be greatly appreciated.

Environment Details:

  • Azure Function App: Non-containerized
  • MySQL Flexible Server: Within a VNet

Thank you!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,250 questions
Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
875 questions
Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
486 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pinaki Ghatak 5,310 Reputation points Microsoft Employee
    2024-11-27T09:57:31.4333333+00:00

    Hello @Ofek Waiz

    Firstly, the error message you received indicates that the system-assigned identity for your Function App does not exist.

    You can try enabling the system-assigned identity for your Function App by running the following Azure CLI command:

    az functionapp identity assign --name --resource-group

    Once you have enabled the system-assigned identity for your Function App, you can try creating the service connector again using the Azure CLI command you mentioned earlier. If you are still encountering issues, you can try connecting to the VNet from your local environment using a VPN or ExpressRoute connection.

    Once you are connected to the VNet, you should be able to execute the Azure CLI command to create the service connector.

    Alternatively, you can try using the Azure Portal to create the service connector. To do this, you will need to create a Virtual Network Service Endpoint for your MySQL Flexible Server and then create the service connector using the Azure Portal.

    You can find more information on how to do this in the following article: Create and manage virtual networks for Azure Database for MySQL - Flexible Server using the Azure CLIL.


    I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.


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.