跳到主要內容
AI News HubLIVE
來源內容 · 翻譯待補全5 分鐘閱讀

待翻譯:Now GA: Building permission-aware Databricks Apps with on-behalf-of-user authorization

文章摘要

AI 服務暫時不可用,以下為來源摘要,待恢復後補全翻譯:Databricks Apps lets developers build and deploy data and AI applications directly on the Databricks platform...

待翻譯:Now GA: Building permission-aware Databricks Apps with on-behalf-of-user authorization
回報錯誤

更正管道尚未開通,可先複製下方文章資訊留存。

查看更正說明
直接讀正文

AI 服務暫時不可用,以下為來源正文,待恢復後補全翻譯。

Now GA: Building permission-aware Databricks Apps with on-behalf-of-user authorization | Databricks Blog Build permission-aware Databricks Apps: Use app authorization for app-owned work and OBO for actions governed by the signed-in user. Limit access by scope: API scopes limit what the app can do on behalf of the user; the user's warehouse and Unity Catalog permissions limit which data it can access. Operate securely at scale: Keep app and user clients separate, use the forwarded token only for the active request, and fail closed if it's missing. Never store user tokens. Databricks Apps lets developers build and deploy data and AI applications directly on the Databricks platform, from interactive dashboards and operational tools to custom AI agents. Now generally available, on-behalf-of-user (OBO) authorization makes it possible to build apps that deliver personalized, permission-aware experiences without reimplementing data-governance rules in application code. When an app calls supported Databricks APIs with OBO, it acts using the signed-in user’s identity: Unity Catalog enforces that user’s existing data permissions, including row filters and column masks, and API scopes limit the operations the app can perform on the user’s behalf. Apps can continue to use their dedicated service principal for app-owned operations, such as reading shared configuration or writing application metrics. For example, a sales-insights assistant can answer questions using only the accounts and fields a salesperson is authorized to access, without giving the app broad SQL or workspace-administration capabilities. Start with the identity that governs each operation When designing an app, ask: Whose permissions should govern this particular operation? Databricks Apps supports two complementary authorization models: app authorization and user authorization. App authorization uses the app’s dedicated service principal and is appropriate for app-owned operations or experiences that should return the same result to every user. User authorization uses the signed-in user’s identity when that user’s permissions should govern an operation. Most production apps can use both models, choosing the appropriate identity for each request path. See Configure authorization in a Databricks app. Operation Authorization identity Scope Why Query data filtered by the current user User authorization (OBO) API scope: sql:restricted-query The query runs as the user and is limited to read-only SQL queries. Read shared configuration or metadata App authorization App identity permissions The app’s service principal provides consistent access. Run background jobs or maintenance App authorization App identity permissions Background work should not depend on a user session. Perform a user-triggered action on governed data User authorization (OBO) The API scope required for that operation The action is evaluated using the initiating user’s permissions. Combine shared behavior with user-specific data Both Separate API scopes for each user-authorized capability Use an app client for app-owned operations and a user client for governed operations. Consider an app that answers questions such as: How are my accounts performing this quarter, and what explains the change? The app needs to: Query sales and customer data as the requesting user. Respect Unity Catalog permissions, including row-level filters and column masks. Return read-only analysis. Optionally call a separate service to summarize the results. Avoid modifying data or managing SQL resources. This is a natural fit for user authorization. The app passes the requesting user’s forwarded access token to the SQL connector, and Databricks evaluates the query using that user’s existing warehouse and Unity Catalog permissions. A regional manager might see only accounts in their region, while a national leader sees all regions, without the app recreating those rules in code. When administrators update Unity Catalog policies, subsequent app requests reflect those changes. The user’s permission determines which data the query can return. The next design decision is what the app is allowed to do on the user’s behalf with the forwarded user token. Use the narrowest API scope that matches the job The sales-insights assistant needs to execute read-only queries. It does not need broad SQL access to manage resources or perform other SQL operations. For that reason, it should request sql:restricted-query rather than the broader sql scope. sql:restricted-query allows the app to execute read-only SQL queries. It does not allow the app to perform other SQL operations. This creates a better match between the app’s product behavior and its authorization boundary: the app can read governed data for analysis, but it cannot use the user’s identity as a broad SQL operating credential. If the app also invokes Genie or Unity Gateway on a user’s behalf, request only the corresponding scopes, such as genie or ai-gateway. Do not request files, model-serving, or vector-search unless the app actually uses those capabilities. Scopes are a capability ceiling, not a grant of data access. The app must have the appropriate API scope, and the user must still have permission to access the target resource. See Scope-based security and privilege escalation. Configure the app with an explicit API scope Configure user authorization in the Databricks UI or in a Declarative Automation Bundle. For a read-only analytics assistant, the app can declare: Note: The API scope is part of the app’s declared user-authorization configuration. It does not grant access to a SQL warehouse or Unity Catalog data. The requesting user must still be allowed to use the target SQL warehouse and have the required Unity Catalog privileges on the data being queried. When a user first accesses a user-authorized app, Databricks prompts them to consent to the requested API scopes. Pass the user identity to the SQL connector Databricks forwards the current user’s access token in the x-forwarded-access-token HTTP header. The app should retrieve that token for the request that needs user-context access and pass it to the SQL connector. The following example uses Flask and the Databricks SQL Connector for Python to make the token flow explicit. If you build the app with Databricks AppKit, apply the same authorization principle: use the user-context client or request-time identity for user-specific operations, and keep app-owned operations on the app identity. Note: The forwarded token is short-lived and per-request. The app reads it on each request and never stores it across requests or in a session. The important difference from app authorization is that the connector receives the forwarded user token through access_token. The sql:restricted-query API scope limits the app to the read-only SQL capability it needs, while Unity Catalog determines which rows and columns that user can actually access. See Query with user authorization. Let workspace administrators set the upper boundary Developers specify which API scopes their app needs. Workspace administrators can control which API scopes app developers are allowed to add to apps in the workspace. That policy lets teams build read-only analytics and AI experiences while preventing apps from requesting broader or unrelated capabilities. An app developer cannot expand the app’s authorization beyond the workspace’s configured API-scope boundary. This gives organizations two levels of control: The app declares the minimum API scopes required for its functionality. The workspace administrator defines the maximum API scopes available to apps in that workspace. Workspace administrators configure this allowlist under Settings > Development > Apps. The setting defaults to all supported APIs, can be narrowed to selected API scopes, or can be set to None to disable user authorization. See Restrict user authorization scopes. Account administrators can add scopes even when those scopes are not included in the workspace allowlist. If an administrator later removes an allowed scope, apps already running with that scope can continue running, but they cannot be started, deployed, or updated until the non-allowed scope is removed. Keep app-owned and user-owned operations separate Many useful apps need both authorization models. The sales insights assistant might use: An app-scoped client to write application metrics or read shared configuration. A user-scoped client with sql:restricted-query to query data for the current user. A separate user API scope if it needs to invoke another Databricks service on the user’s behalf. It is advisable to make that identity boundary explicit in application code instead of creating one generic client and reusing it everywhere. Separate dependencies, names, and tests help prevent an app credential from being used for a user-specific path or a user token from being retained for background work. If a request requires user authorization and the forwarded token is missing, fail closed rather than silently switching to the app’s service principal. Otherwise, the app could return a response that looks valid but was generated with different permissions. That is why query_as_user in the example above starts with require_user_token instead of handling the missing header inline. Apply the same pattern to agents Custom agents deployed on Databricks Apps can use the same model. Initialize the user-scoped workspace client inside the request-time invoke or stream handler—not at application startup—because the forwarded user token is available only during an active user request. Use app authorization for shared resources and background operations. See Authentication for agents. Secure the implementation Request only the minimum API scopes required. Keep app-owned and user-authorized clients separate in code, tests, and dependency wiring. Never print, log, or persist forwarded access tokens. Restrict app management to trusted developers and require peer review for authorization-related changes. Use app authorization for shared and background operations rather than retaining user tokens. Test with users whose Unity Catalog access differs, then repeat those tests after policy changes. Get started On-behalf-of-user authorization gives you personalization and governance from the same mechanism. The user's Unity Catalog permissions decide what data an app can reach, and the narrowest matching API scope decides what it can do on their behalf. To get started, check out our help documentation for more resources and best practices. Get the latest posts in your inbox Subscribe to our blog and get the latest posts delivered to your inbox. Sign up View all blogs

展開要點與分析

文章情報

投資人中級

要點

  • AI 服務暫時不可用,系統已先保留來源內容與降級後設資料。
  • Databricks Apps lets developers build and deploy data and AI applications directly on the Databricks platform...

技術影響

可能影響 Agent 架構、工具呼叫、工作流自動化和產品整合。

要點與分析由自動化流程生成,可能有誤,請結合原始來源核實。