Execute permissions of a scalar function on Sql Server data source not working

I am using Grafana 8.5.10.
I have developed some simple scalar functions on my SQL Server DB.
I have given to the user I use for grafana the function execution permissions with:

GRANT EXECUTE ON dbo.FunctionName to grafanareader;

I’m trying to use these functions in a Grafana Panel but it gives an error:

“The EXECUTE permission was denied on the object dbo.FunctionName”

If I try the same query directly on MSSQL after authenticating with the grafanareader account it works without problems.

What I’m missing?

Thank you


what user are you using to login to the mssql datasource in grafana?

grafanareader, the same account I have given the execute permissions to.

let me try it locally. @matteodt does you sf reference any tables? works for me with following perms


My grafana DB account (named grafanareader) has only public and db_datereader permissions.

But as I said if I login with this account to the DB using MSSQL-SMS the call of scalar function works well, so the login has the right permissions.

But using the same login from inside Grafana gives error calling the same functions.

Copying them inside MSSQL Server Management Studio, and logging in with the same login used by Grafana, it works, so it is Grafana problem.

:man_shrugging: what kind of grafana installation do you have? docker? grafana in windows install?

Windows installation of Grafana 8.5.10.

1 Like

works on my 8.5.10
Can you create a fake procedure, give it execute permissions and use that proc in grafana and see if same thing happens?

1 Like

Sorry it was my fault, not Grafana.
Please delete this topic.