Hello Ayush Shrivastava,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
Problem
I understand that you would like to know the way to log messages in Azure SQL database directly which is similar to what you do with any springboot application.
Solution
To log messages directly into an Azure SQL Database, you can use several approaches. The approach depends on your application. Few common methods, including using ADO.NET in C#, Entity Framework, and Azure Functions.
Using ADO.NET in C#
Connecting to SQL Database with ADO.NET. https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-dotnet-core
Execute a Simple Command Using a SqlCommand. https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/enhanced-sql-command-support
Using Entity Framework
Working with Azure SQL Database and EF Core. https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connect-entity-framework-core
Using Azure Functions
Use Azure Functions to connect to an Azure SQL Database. https://docs.microsoft.com/en-us/samples/azure-samples/functions-dotnet-mysql-data-access/use-azure-functions-to-connect-to-an-azure-sql-database/
However, if you would like to be logging messages directly into an Azure SQL Database from a Spring Boot application can be done efficiently using Spring Data JPA.
- Accessing Data with Spring Data JPA. https://spring.io/guides/gs/accessing-data-jpa/
- Connect a Spring Boot application to Azure SQL Database. https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-data-jdbc-with-azure-sql
- Spring Boot with Spring Data JPA. https://www.baeldung.com/the-persistence-layer-with-spring-data-jpa
References
Kindly use the provided links above as references for more detail steps.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam