What you will be able to do
- Generate iframe embed code for a published dashboard and explain who can view it
- Describe the workspace admin embedding policy and the approved-domains list
- Explain how embedding for external users uses a service principal, user-scoped tokens and __aibi_external_value
- Choose the publishing option that keeps external embedding from exposing data
1.Basic embedding with an iframe
Embedding puts a dashboard inside another website or tool, such as a wiki page, a Salesforce page or an internal portal. Only published dashboards can be embedded, and the sharing grants set on the dashboard still govern who can see it.
To get the embed code, open the published dashboard, click Share, then click Embed dashboard in the Sharing dialog. A Copy embed code dialog opens. If your workspace has a list of approved domains, the dialog shows it. Copy the snippet and paste it into any page that can render HTML iframes.
<iframe src="https://<databricks-instance-name>/embed/dashboardsv3/<dashboard-and-workspace-ID>" width="100%" height="600" frameborder="0"></iframe>Basic embedding is for people who already have a Databricks identity. Viewers are prompted to sign in with their Databricks credentials, unless they have an active session from a recent sign-in to that workspace. A registered user without a grant gets an error saying the dashboard is unavailable. Customers or partners with no Databricks identity are out of reach for this method.
A blank iframe usually means the viewer's browser blocks third-party cookies, which embedded dashboards need in order to load data.
Checkpoint 1 of 6· Fill the gap
Which path segment completes the embed code that the Copy embed code dialog generates?
<iframe src="https://<databricks-instance-name>/ ? /dashboardsv3/<dashboard-and-workspace-ID>" width="100%" height="600" frameborder="0"></iframe>The generated snippet is an iframe whose src points at the dashboard's /embed/ URL. You get it from Share > Embed dashboard on a published dashboard, not from the regular shareable link.
Source: docs.databricks.comCheckpoint 2 of 6· Check yourself
An author embeds a published dashboard in an internal portal using the iframe code. A user is registered in the Databricks account but was never granted access to the dashboard. They sign in on the portal page. What happens?
Embedding doesn't widen who can see a dashboard. The usual sharing settings still apply, so a registered user without a grant gets an 'unavailable' error, not the dashboard.
“registered user who has not been granted access to the dashboard tries to view it, they receive an error that says the dashboard is unavailable”Source: docs.databricks.com
2.The admin embedding policy and approved domains
A dashboard author cannot decide alone where a dashboard may appear. The external website has to be explicitly allowed, and only a workspace admin can set that. The setting is under the username menu: Settings → Security, in the External access section, under Embed dashboards. The same policy covers dashboards and Genie Agents.
| Policy | Effect |
|---|---|
| Allow | Dashboards and Genie Agents can be embedded in any domain |
| Allow approved domains | Embedding works only on sites that match the approved list |
| Deny | Dashboards and Genie Agents cannot be embedded in any domain |
With Allow approved domains, the admin clicks Manage next to Embed Dashboards, enters each domain and clicks Add domain, then clicks Save. This is the usual fix when an author's Copy embed code dialog lists domains and the target site is not one of them. The author cannot add it. A workspace admin must.
Checkpoint 3 of 6· Check yourself
Your workspace uses the Allow approved domains policy. The Copy embed code dialog lists two domains, but the partner wiki where you want to show the dashboard is not one of them. As the dashboard author with CAN MANAGE, what gets the embed working there?
Where a dashboard can be embedded is set by the workspace embedding policy, and only a workspace admin can change it. Under Allow approved domains, the admin adds the domain under Settings → Security → Embed dashboards. Neither the publishing option nor dashboard grants affect the domain list.
“If your Copy embed code dialog includes a list of allowed domains that does not include your target domain, a workspace admin can add it.”Source: docs.databricks.com
3.Embedding for external users
Embedding for external users serves viewers who have no Databricks account at all. One example is a property-management portal that shows each manager a dashboard for each of their buildings. Viewers never sign in to Databricks. Instead, your application signs in as a service principal with an OAuth secret, and Databricks gives it scoped access tokens for each viewer.
| Embedding method | How users authenticate | How permissions are evaluated | Typical use case |
|---|---|---|---|
| Databricks-authentication (basic) | Users sign in with their Databricks account | Users' own permissions are checked; with shared data permissions, the publisher's permissions apply to data | Users registered in the Databricks account |
| Embedding for external users | The application authenticates with a service principal and OAuth token | The service principal's permissions control API access; shared data permissions, if used, still decide data access | External users, portals, broad distribution |
The token exchange happens in four steps:
- A user signs in to your application, and its frontend asks your server for a dashboard token.
- Your server uses the service principal secret to get a broadly scoped OAuth token from Databricks. It then calls the
/tokeninfoendpoint, passingexternal_viewer_idandexternal_value. - Using that response, your server creates a tightly scoped token for that one user.
- The page creates a
DatabricksDashboardobject from@databricks/aibi-clientand passes it the user-scoped token. The dashboard then renders with that user's context.
The two values you pass in have different jobs. external_viewer_id is written to the audit logs. It must be unique per user and must not contain personally identifiable information. external_value is used when queries run and may contain PII. Together the two must not exceed 1 KB. Dataset queries can refer to external_value as __aibi_external_value, which filters the data for each viewer:
SELECT *
FROM sales
WHERE region = __aibi_external_valueSetup needs at least CAN MANAGE on a published dashboard and an approved-domains list from a workspace admin. Then create the service principal, with Databricks SQL access and Workspace access enabled, and generate its secret. Copy the secret straight away, because it cannot be shown again. Finally, share the dashboard with the service principal in the Sharing dialog at CAN RUN. External embedding is limited to 20 dashboard loads per second.
Checkpoint 4 of 6· Fill the gap
For a dashboard embedded for external users, which identifier completes this dataset query so that each viewer only sees rows for the value carried in their user-scoped token?
SELECT *
FROM sales
WHERE region = ? Dataset queries refer to the token's external_value as __aibi_external_value, and that filters the data for each viewer. external_viewer_id is written to the audit logs and must not contain PII. It is not used for filtering.
Source: docs.databricks.comCheckpoint 5 of 6· Check yourself
A property-management portal embeds a dashboard for external users. The app authenticates as a service principal whose data grants are narrower than the publisher's, and the dashboard was published with the default Share data permissions. Whose access decides the data that portal viewers see?
The service principal's permissions control API access. If the dashboard is published with shared data permissions, data is still read with the publisher's credentials, not the service principal's.
“If the dashboard is published with shared data permissions, the publisher’s permissions are used for data access, not the service principal’s.”Source: docs.databricks.com
Sources4
4.Choosing the publishing option for external embeds
For external embedding, publish with individual data permissions and grant data access to the service principal. With shared data permissions, the publisher's access decides what data is read, and the service principal's grants count only for API calls. If the publisher later gets access to more data, every external viewer could get it too. With individual data permissions, the service principal needs at least SELECT on every table and view the dashboard uses. It needs no compute grant, because compute always runs with the publisher's credentials.
Keep the service principal limited to the tables the dashboard needs. Databricks cannot always tell in advance which tables a dashboard will query, especially when queries use parameters. Embedding tokens are valid for one hour. If a token without proper scoping leaks, an attacker could use it during that hour to read any table included in a later version of the dashboard. Limiting the service principal's grants caps that exposure.
Checkpoint 6 of 6· Check yourself
You follow the recommended setup for an external-user embed and publish the dashboard with individual data permissions. The service principal already has CAN RUN on the dashboard. What else does it need so the widgets show data?
With individual data permissions, the service principal's own data grants decide what is read, so it needs at least SELECT on the tables and views the dashboard uses. Compute always runs with the publisher's credentials, so the principal needs no warehouse grant.
“Compute access always uses the publisher’s credentials, so you do not need to grant compute permissions to the service principal.”Source: docs.databricks.com
Sources
(4)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Only published dashboards can be embedded into external applications.”
↩︎ Basic embedding with an iframe“Dashboard authors can generate iframe code from the Share dialog.”
↩︎ Basic embedding with an iframe“Viewers are prompted to sign in to Databricks unless they have an active session from a recent sign-in to the originating workspace.”
↩︎ Basic embedding with an iframe“ensure that third-party cookies are enabled in your browser.”
↩︎ Basic embedding with an iframe“Databricks recommends publishing the embedded dashboard with individual data permissions and assigning required data permissions to the service principal associated with the application”
↩︎ Choosing the publishing option for external embeds“Tokens used for embedding for external users are valid for one hour.”
↩︎ Choosing the publishing option for external embeds“If the dashboard is published with shared data permissions, the publisher’s permissions are used for data access, not the service principal’s.”
↩︎ Checkpoint - 2.
“Click Embed dashboard in the Sharing dialog.”
↩︎ Basic embedding with an iframe“they receive an error that says the dashboard is unavailable”
↩︎ Basic embedding with an iframe“does not include your target domain, a workspace admin can add it.”
↩︎ The admin embedding policy and approved domains“registered user who has not been granted access to the dashboard tries to view it, they receive an error that says the dashboard is unavailable”
↩︎ Checkpoint“If your Copy embed code dialog includes a list of allowed domains that does not include your target domain, a workspace admin can add it.”
↩︎ Checkpoint - 3.https://docs.databricks.com/aws/en/ai-bi/admin/embedOfficial docs
“Embedding a dashboard or Genie Agent requires that the external website be explicitly allowed.”
↩︎ The admin embedding policy and approved domains“Allow approved domains: Dashboards and Genie Agents can only be embedded in sites that match the approved list.”
↩︎ The admin embedding policy and approved domains“Scroll down to the External access section.”
↩︎ The admin embedding policy and approved domains“Embedding a dashboard or Genie Agent requires that the external website be explicitly allowed.”
↩︎ Exam trap 2 - 4.
“Embedding for external users uses a service principal and scoped access tokens to authenticate and authorize access to embedded dashboards.”
↩︎ Embedding for external users“Your server uses the service principal secret to request and receive an OAuth token from the Databricks server.”
↩︎ Embedding for external users“Queries in dashboard datasets can reference __aibi_external_value to apply per-user filters”
↩︎ Embedding for external users“external_viewer_id is passed to your dashboard audit logs and must not include personally identifiable information.”
↩︎ Embedding for external users“The combined size of external_viewer_id and external_value must not exceed 1 KB.”
↩︎ Embedding for external users“Set the permission level to CAN RUN.”
↩︎ Embedding for external users“External embedding has a rate limit of 20 dashboard loads per second.”
↩︎ Embedding for external users“You must have at least CAN MANAGE permissions on a published dashboard.”
↩︎ Embedding for external users“To read and display data, the service principal must have at least SELECT privileges on the tables and views referenced in the dashboard.”
↩︎ Choosing the publishing option for external embeds“so you do not need to grant compute permissions to the service principal.”
↩︎ Choosing the publishing option for external embeds“Its permissions apply only if the dashboard is not published with shared data permissions.”
↩︎ Exam trap 1“Its permissions apply only if the dashboard is not published with shared data permissions.”
↩︎ Prediction“Compute access always uses the publisher’s credentials, so you do not need to grant compute permissions to the service principal.”
↩︎ Checkpoint