Power Query Permission Required to Run Native Database Query
In Power BI getting data from SQL Server using Windows authentication and opening Power Query shows Permission is required to run this native database query
.
As seen in ChatGPT, the Power BI forum and StackOverflow.
Most answers in the Power BI forum point to the Settings in Security to disable Require user approval for new native database queries
. However, I don’t think this is a good answer given that if the query has an alter table, it would modify the source table and break something else up/down stream.
A more correct solution is to review the security settings at the source in SQL Server and grant the proper permissions.
With Windows Authentication to SQL Server
- In SSMS connect to the SQL Server
- Go to
Security
folder in Object Explorer. Right click on the Logins folder and select a New Login - For the corresponding user, in the
Login New
enter theWindows account name
- Under
Server Roles
, select Public role - Under
User Mapping
, select the database, then selectdb_datareader
andpublic
roles - OK to save the login.
With Active Directory to SQL Server
- SSMS connect to SQL Server
Security
folder inObject Explorer
. Right click onLogins
. SelectNew Login
- In
Login - New
, selectWindows Authentication
. Enter theAD account name
- Under
User Mapping
, select the database, then grantdb_datareader
to the AD account. - OK to save the login.
With Active Directory to Azure SQL Database
- Check the Azure AD user account was granted permission to the SQL database as
db_datareader
- With Azure AD authentication
- Create an AAD user account or group
- Configure the SQL DB to use that account/group
- Use Power BI with
AAD with MFA
authentication