cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unable to run sql alert task using databricks job using service principal

GANAPATI_HEGDE
New Contributor III

I am trying to run a SQL alert task in data bricks job, Service principal is the run_as as set to the job, and task fails with below error message.

 

 I also checked if SPN can be granted permission on SQL alert and SQL query, turns out only user id or AD group can be granted permissions.  Has anyone seen this error before?

GANAPATI_HEGDE_0-1761623911949.jpeg

8 REPLIES 8

szymon_dybczak
Esteemed Contributor III

Hi @GANAPATI_HEGDE ,

According to docs:

  • For service principal: Set service_principal_name to the application ID. Requires the servicePrincipal/user role. If not specified, the alert will run as the request user.

So instead of using service principal name try to pass application ID.

GANAPATI_HEGDE
New Contributor III

Where do i pass the service principal name?

GANAPATI_HEGDE
New Contributor III

Can you share the docs as well so that i can read about it?

 

GANAPATI_HEGDE
New Contributor III

It doesnt really explain where to set the run as username for alerts, when i check in the jobs UI, i dont see option to set run_as as well

Create Alert in regular way. After your alert is created:

1. Go to Alerts

szymon_dybczak_0-1761640112347.png

2. Select your alert

szymon_dybczak_1-1761640130223.png

3. Click pencil next to run as to edit:

szymon_dybczak_2-1761640157502.png

4. Provide application id of your service principal and clik save:

szymon_dybczak_3-1761640218935.png

 

GANAPATI_HEGDE
New Contributor III

GANAPATI_HEGDE_0-1761640889010.png

unfortunately, only these options are available in my UI, is it the new UI?

Yes, it seems that you're  using legacy alerts:

What are legacy alerts? | Databricks on AWS

To switch to alerts v2 follow this guide:

Databricks SQL alerts | Databricks on AWS