简体   繁体   中英

Query on Azure SQL database on behalf of user in a REST-API

I am building a REST-API that talks to an Azure SQL database using .NET core 2.2 and C#. The API runs as a webapp on Azure. The user-access rights are managed by the database itself. My API requires the users expects users to have a Microsoft account and to be registered in Azure Active Directory and the authentication is done using Bearer tokens.

Is it possible to perform a query on the database on behalf of the user? In other words having the same access rights as if the user logged in to the database directly and performed the query himself.

I believe they need to be Azure Active Directory users if you want to grant access that way. The other option is to use SQL authentication and manage the connection string (user & password) in your web api layer.. This document from Microsoft explains the process for each: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-manage-logins

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM