Hello @Bina Trivedi
I would recommend you to use Azure SQL Database Passwordless Connections as this is the most secured way for DB connection.
There are simple configurations steps in Azure SQL and Azure App Service:
- Enable Azure AD authentication with Azure SQL
- Activate the Managed Identity
- Create the database user for the created Managed Identity
- Assign permissions in Azure SQL for a user
- Use Azure.Identity in Java code