Any advice about how to connect a spfx web part using the react template to an azure sql database.

But can't seem to find a clear example. I'd be looking to bind controls e.g. Combo boxes to a sql azure sql table

Any help will be greatly appreciated.


You need to remember that anything that runs client side is able to be sniffed out by the end user, so any front end code connecting to a database would necessarily expose the connection details back to the end user - the keys to the kingdom, if you will. This is an egregious security risk.

Best practice is to deploy a custom secured web service, and have the web part call that instead.

There's a lot of ways to achieve this, but very common is to use Azure Functions and/or ASP.Net secured with Azure Active Directory: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.