ストレージの資格情報を管理する
この記事では、 ストレージ資格情報の一覧表示、表示、更新、アクセス許可の付与、および削除の方法について説明します。
Databricks では、ストレージ資格情報に対する CREATE EXTERNAL LOCATION
権限のみを付与し、他の権限は付与しないことをお勧めします。
この記事では、Catalog Explorer と SQL コマンドを使用してストレージ資格情報を管理する方法について説明します。 代わりに Databricks CLI を使用する方法については、「Databricks CLIとは」を参照してください。
ストレージ資格情報の一覧表示
メタストア内のすべてのストレージ資格情報の一覧を表示するには、カタログ エクスプローラーまたは SQL コマンドを使用できます。
- Catalog Explorer
- SQL
- In the sidebar, click
Catalog.
- On the Quick access page, click the External data > button and go to the Credentials tab.
- Sort the credentials by Purpose (STORAGE or SERVICE).
Run the following command in a notebook or the Databricks SQL editor.
SHOW STORAGE CREDENTIALS;
ストレージの資格情報を表示する
ストレージ認証情報のプロパティを表示するには、Catalog Explorer または SQL コマンドを使用できます。
- Catalog Explorer
- SQL
- In the sidebar, click
Catalog.
- On the Quick access page, click the External data > button and go to the Credentials tab.
- Click the name of a storage credential to see its properties.
Run the following command in a notebook or the Databricks SQL editor. Replace <credential-name>
with the name of the credential.
DESCRIBE STORAGE CREDENTIAL <credential-name>;
ストレージ資格情報に権限を表示する
ストレージ資格情報の許可を表示するには、次のようなコマンドを使用します。オプションで、結果をフィルタリングして、指定したプリンシパルの許可のみを表示できます。
SHOW GRANTS [<principal>] ON STORAGE CREDENTIAL <storage-credential-name>;
プレースホルダーの値を置き換えます。
<principal>
:アカウントレベルのユーザーのメールアドレス、またはアクセス許可を付与するアカウントレベルのグループの名前。<storage-credential-name>
:ストレージ資格情報の名前。
グループまたはユーザー名にスペースまたは @
記号が含まれている場合は、アポストロフィではなくバッククォートで囲みます。 たとえば 財務チームは.
外部ロケーションを作成する権限を付与する
ストレージ認証情報を使用して外部ロケーションを作成する権限を付与するには、次の手順を実行します。
- Catalog Explorer
- SQL
- In the sidebar, click
Catalog.
- On the Quick access page, click the External data > button and go to the Credentials tab.
- Click the name of a storage credential to open the details page.
- Click Permissions.
- To grant permission to users or groups, select each identity, then click Grant.
- To revoke permissions from users or groups, select each identity, then click Revoke.
Run the following command in a notebook or the SQL query editor:
GRANT CREATE EXTERNAL LOCATION ON STORAGE CREDENTIAL <storage-credential-name> TO <principal>;
Replace the placeholder values:
-
<principal>
: The email address of the account-level user or the name of the account level group to whom to grant the permission. -
<storage-credential-name>
: The name of a storage credential.
If a group or username contains a space or @
symbol, use back-ticks around it (not apostrophes). For example
finance team
.
ストレージ資格情報の所有者を変更する
ストレージ認証情報の作成者は、その初期所有者です。 所有者を別のアカウントレベルのユーザーまたはグループに変更するには、Catalog Explorer または SQL コマンドを使用できます。
- Catalog Explorer
- SQL
- In the sidebar, click
Catalog.
- On the Quick access page, click the External data > button and go to the Credentials tab.
- Click the name of a storage credential to open the edit dialog.
- Click
next to Owner.
- Type to search for a principal and select it.
- Click Save.
Run the following command in a notebook or the Databricks SQL editor. Replace the placeholder values:
<credential-name>
: The name of the credential.<principal>
: The email address of an account-level user or the name of an account-level group.
ALTER STORAGE CREDENTIAL <credential-name> OWNER TO <principal>;
ストレージ認証情報を読み取り専用としてマークする
ストレージ認証情報によって管理されるすべてのデータに対する読み取り専用アクセスをユーザーに付与する場合は、カタログエクスプローラーを使用してストレージ認証情報を読み取り専用としてマークできます。
ストレージ認証情報を読み取り専用にすると、その認証情報で設定されたストレージはすべて読み取り専用になります。
ストレージの認証情報は、作成時に読み取り専用としてマークできます。
また、カタログエクスプローラーを使用して、ストレージ資格証明の作成後に読み取り専用ステータスを変更することもできます。
- カタログ エクスプローラで、ストレージ認証情報を検索し、オブジェクト行の
ケバブ メニューをクリックして、[ 編集 ] を選択します。
- 編集ダイアログで[ 読み取り専用 ]オプションを選択します。
ストレージ資格情報の名前を変更する
ストレージ資格情報の名前を変更するには、カタログエクスプローラーまたは SQL コマンドを使用できます。
- Catalog Explorer
- SQL
- In the sidebar, click
Catalog.
- On the Quick access page, click the External data > button and go to the Credentials tab.
- Click the name of a storage credential to open the edit dialog.
- Rename the storage credential and save it.
Run the following command in a notebook or the Databricks SQL editor. Replace the placeholder values:
<credential-name>
: The name of the credential.<new-credential-name>
: A new name for the credential.
ALTER STORAGE CREDENTIAL <credential-name> RENAME TO <new-credential-name>;
ストレージ資格情報を削除する
ストレージ認証情報を削除 (ドロップ) するには、その所有者である必要があります。 ストレージ認証情報を削除するには、Catalog Explorer または SQL コマンドを使用できます。
- Catalog Explorer
- SQL
- In the sidebar, click
Catalog.
- On the Quick access page, click the External data > button and go to the Credentials tab.
- Click the name of a storage credential to open the edit dialog.
- Click the Delete button.
Run the following command in a notebook or the Databricks SQL editor. Replace <credential-name>
with the name of the credential. Portions of the command that are in brackets are optional. By default, if the credential is used by an external location, it is not deleted. Replace <credential-name>
with the name of the credential.
IF EXISTS
does not return an error if the credential does not exist.
DROP STORAGE CREDENTIAL [IF EXISTS] <credential-name>;