Hi @Chen, Carson-WQ ,
Thank you for posting this question on Microsoft Q&A.
I understand that you want to connect to MSSql Server on an Azure VM from Java Azure Function App. I assume that you are trying to connect to the "SQL DB" so that you can query the data stored in SQL Server.
For the scenario mentioned above, the basic concepts are the same in both cases (for Azure SQL DB as PAAS and for Azure SQL DB hosted on Azure VM as IAAS) :
1. Get the ServerName, DB instance name and the port. For Azure SQL on Azure VM, please follow the link here: Connect to SQL Server to connect to the DB from your local machine to get these values and to ensure that you are able to connect. Also, ensure that respective ports are open on NSG/Firewall for connectivity.
2. Once you are able to connect to the SQL DB from Sql Server Management Studio, as mentioned in point 1 above, you can use these values to create Connection URL and use it in your Java Azure Function.
Please let me know if you have any questions.
---
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.