Unable to run sql alert task using databricks job using service principal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2025 08:59 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 12:04 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 12:16 AM
Where do i pass the service principal name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 12:18 AM
Can you share the docs as well so that i can read about it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 12:44 AM
Hi,
It's described at their REST API docs:
Create an alert | Alerts V2 API | REST API reference | Databricks on AWS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 01:02 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 01:30 AM
Create Alert in regular way. After your alert is created:
1. Go to Alerts
2. Select your alert
3. Click pencil next to run as to edit:
4. Provide application id of your service principal and clik save:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 01:41 AM
unfortunately, only these options are available in my UI, is it the new UI?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2025 01:54 AM
Yes, it seems that you're using legacy alerts:
What are legacy alerts? | Databricks on AWS
To switch to alerts v2 follow this guide: