@Amber Huang As mentioned by akinbade, when you are using a Function App on the Basic pricing tier, the outbound IP address is not static and can change frequently. Therefore, it is not recommended to whitelist the outbound IP address of the Function App in your Azure SQL Server.
Instead, you can use the Azure SQL Database firewall to allow access to your database from Azure services. This will allow your Function App to connect to the SQL Server without whitelisting the outbound IP address.
To enable access to your Azure SQL Server from Azure services, you can follow these steps:
- Go to the Azure portal and navigate to your Azure SQL Server.
- Click on the "Firewalls and virtual networks" tab.
- Under the "Allow access to Azure services" section, toggle the switch to "Yes".
- Click on the "Save" button to save the changes.
With this configuration, your Function App will be able to connect to the Azure SQL Server without any issues. Please note that enabling access to Azure services will allow any Azure service to connect to your Azure SQL Server, so make sure to secure your database with strong authentication and authorization mechanisms.