カタログへのアクセスを特定のワークスペースに制限する
この記事では、ワークスペースとカタログのバインドについて説明し、 Unity Catalog カタログを Databricks ワークスペースにバインドして、 Databricks アカウント内の他のワークスペースがアクセスできないようにする方法について説明します。
ワークスペースとカタログのバインドとは
ワークスペースを使用してユーザーデータへのアクセスを分離する場合は、カタログへのアクセスをアカウント内の特定のワークスペースに制限できます(ワークスペースとカタログのバインディングとも呼ばれます)。 デフォルトは、現在のメタストアに接続されているすべてのワークスペースとカタログを共有することです。
このデフォルトの例外は、すべての新しいワークスペースに対して自動的に作成される ワークスペース カタログ です。 このワークスペース カタログは、他のワークスペースにアクセス権を付与することを選択しない限り、自分のワークスペースにのみバインドされます。 このカタログのバインドを解除する場合のアクセス許可の割り当てに関する重要な情報については、「 ワークスペースからのカタログのバインド解除」を参照してください。
ワークスペースからカタログへの読み取りおよび書き込みアクセスを許可することも、読み取り専用アクセスを指定することもできます。 読み取り専用を指定すると、そのワークスペースからそのカタログへのすべての書き込み操作がブロックされます。
カタログを特定のワークスペースにバインドする一般的な使用例には、次のようなものがあります。
- ユーザーが本番運用 ワークスペース環境からのみ本番運用データにアクセスできるようにします。
- ユーザーが専用のワークスペースからのみ機密データを処理できるようにします。
- 開発者ワークスペースから本番運用データへの読み取り専用アクセスをユーザーに付与して、開発とテストを可能にします。
また、外部ロケーションとストレージの認証情報を特定のワークスペースにバインドして、外部ロケーションのデータにアクセスする機能をそれらのワークスペースの特権ユーザーに制限することもできます。 「(オプション) 特定のワークスペースに外部ロケーションを割り当てる」および「(オプション) 特定のワークスペースにストレージ資格情報を割り当てる」を参照してください。
ワークスペースとカタログのバインドの例
本番運用と開発の分離の例を見てみましょう。 実稼働データカタログに実稼働ワークスペースからのみアクセスできるように指定した場合、これはユーザーに発行される個々の許可よりも優先されます。
この図では、 prod_catalog
は 2 つの本番運用ワークスペースにバインドされています。 ユーザーが my_table
という prod_catalog
のテーブルへのアクセスを許可されているとします (GRANT SELECT ON my_table TO <user>
を使用)。ユーザーが Dev ワークスペースで my_table
にアクセスしようとすると、エラー メッセージが表示されます。 ユーザーは、Prod ETL ワークスペースと Prod アナリティクス ワークスペースからのみmy_table
にアクセスできます。
ワークスペースとカタログのバインドは、プラットフォームのすべての領域で尊重されます。 たとえば、情報スキーマをクエリすると、クエリを発行したワークスペースでアクセス可能なカタログのみが表示されます。 同様に、データ リネージ UI と検索 UI には、ワークスペースに割り当てられたカタログのみが表示されます (バインディングを使用するか、デフォルトを使用するかに関係なく)。
カタログを 1 つ以上のワークスペースにバインドする
カタログを特定のワークスペースに割り当てるには、カタログ エクスプローラーまたは Databricks CLI を使用できます。
必要なアクセス許可 : メタストア管理者、カタログ所有者、またはカタログの MANAGE
と USE CATALOG
。
メタストア管理者は、カタログが現在のワークスペースに割り当てられているかどうかに関係なく、カタログ所有者はメタストアで所有しているすべてのカタログをカタログ エクスプローラーを使用して表示できます。 ワークスペースに割り当てられていないカタログはグレー表示され、子オブジェクトの表示やクエリー可能なオブジェクトはありません。
- Catalog Explorer
- CLI
-
Log in to a workspace that is linked to the metastore.
-
Click
Catalog.
-
In the Catalog pane, on the left, click the catalog name.
The main Catalog Explorer pane defaults to the Catalogs list. You can also select the catalog there.
-
On the Workspaces tab, clear the All workspaces have access checkbox.
If your catalog is already bound to one or more workspaces, this checkbox is already cleared.
-
Click Assign to workspaces and enter or find the workspaces you want to assign.
-
(Optional) Limit workspace access to read-only.
On the Manage Access Level menu, select Change access to read-only.
You can reverse this selection at any time by editing the catalog and selecting Change access to read & write.
To revoke access, go to the Workspaces tab, select the workspace, and click Revoke.
There are two Databricks CLI command groups and two steps required to assign a catalog to a workspace.
In the following examples, replace <profile-name>
with the name of your Databricks authentication configuration profile. It should include the value of a personal access token, in addition to the workspace instance name and workspace ID of the workspace where you generated the personal access token. See Databricks personal access token authentication.
-
Use the
catalogs
command group’supdate
command to set the catalog’sisolation mode
toISOLATED
:Bashdatabricks catalogs update <my-catalog> \
--isolation-mode ISOLATED \
--profile <profile-name>The default
isolation-mode
isOPEN
to all workspaces attached to the metastore. -
Use the
workspace-bindings
command group’supdate-bindings
command to assign the workspaces to the catalog:Bashdatabricks workspace-bindings update-bindings catalog <my-catalog> \
--json '{
"add": [{"workspace_id": <workspace-id>, "binding_type": <binding-type>}...],
"remove": [{"workspace_id": <workspace-id>, "binding_type": "<binding-type>}...]
}' --profile <profile-name>Use the
"add"
and"remove"
properties to add or remove workspace bindings. The<binding-type>
can be either“BINDING_TYPE_READ_WRITE”
(default) or“BINDING_TYPE_READ_ONLY”
.
To list all workspace assignments for a catalog, use the workspace-bindings
command group’s get-bindings
command:
databricks workspace-bindings get-bindings catalog <my-catalog> \
--profile <profile-name>
ワークスペースからのカタログのバインド解除
Catalog Explorer または workspace-bindings
CLI コマンド グループを使用してカタログへのワークスペース アクセスを取り消す手順については、「 カタログを 1 つ以上のワークスペースにバインドする」を参照してください。
ワークスペースで Unity Catalog が自動的に有効になっていて、 ワークスペース カタログ がある場合、ワークスペース管理者はそのカタログを所有し、そのカタログに対するすべてのアクセス許可を ワークスペース内でのみ 持ちます。 そのカタログのバインドを解除するか、他のカタログにバインドする場合は、ワークスペース admins グループのメンバーに必要なアクセス許可を手動で個々のユーザーとして付与するか、アカウント レベルのグループを使用して付与する必要があります。これは、ワークスペース admins グループがワークスペース ローカル グループであるためです。 アカウント グループ とワークスペース-ローカル グループの詳細については、「Databricksのグループの種類」を参照してください。