次の方法で共有


Azure Data Explorer のクラスター プリンシパルを追加する

Azure Data Explorer は、ログと利用統計情報データのための高速で拡張性に優れたデータ探索サービスです。 この記事では、C#、Python、または Azure Resource Manager (ARM) テンプレートを使用して、Azure Data Explorer のクラスター プリンシパルを追加する方法について説明します。

前提条件

前提条件は、プリンシパルの追加に使用される方法によって異なります。 任意の方法に関連するタブを選択します。

次の一覧では、C# でクラスター プリンシパルを追加するための前提条件の概要を示します。

クラスター プリンシパルを追加する

次のコードを実行して、クラスター プリンシパルを追加します。

var tenantId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Directory (tenant) ID
var clientId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Application ID
var clientSecret = "PlaceholderClientSecret"; //Client Secret
var subscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var credentials = await ApplicationTokenProvider.LoginSilentAsync(tenantId, clientId, clientSecret);
var kustoManagementClient = new KustoManagementClient(credentials) { SubscriptionId = subscriptionId };
var resourceGroupName = "testrg";
//The cluster that is created as part of the Prerequisites
var clusterName = "mykustocluster";
var clusterPrincipalAssignmentName = "mykustoclusterprincipalassignment";
var principalId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //User email, application ID, or security group name
var role = "AllDatabasesAdmin"; //AllDatabasesAdmin or AllDatabasesViewer
var tenantIdForPrincipal = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
var principalType = "App"; //User, App, or Group
var clusterPrincipalAssignmentData = new ClusterPrincipalAssignment(
    principalId: principalId, role: role, principalType: principalType, tenantId: tenantIdForPrincipal
);
await kustoManagementClient.ClusterPrincipalAssignments.CreateOrUpdateAsync(
    resourceGroupName, clusterName, clusterPrincipalAssignmentName, clusterPrincipalAssignmentData
);
設定 推奨値 フィールドの説明
テナントID xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx あなたのテナントID。 ディレクトリ ID とも呼ばれます。
サブスクリプションID xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx リソースの作成に使用するサブスクリプション ID。
clientId xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx ご利用のテナント内のリソースにアクセスできるアプリケーションのクライアント ID。
クライアントシークレット プレースホルダー・クライアント・シークレット ご利用のテナント内のリソースにアクセスできるアプリケーションのクライアント シークレット。
リソースグループ名 testrg ご利用のクラスターを含むリソース グループの名前。
クラスターネーム mykustocluster ご利用のクラスターの名前。
主要な割り当て名 clusterPrincipalAssignment1 クラスター プリンシパル リソースの名前。
プリンシパルID xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx プリンシパル ID。ユーザーの電子メール、アプリケーション ID、またはセキュリティ グループ名を指定できます。
役割 AllDatabasesAdmin クラスター プリンシパルのロール。"AllDatabasesAdmin"、"AllDatabasesMonitor"、または "AllDatabasesViewer" にすることができます。
プリンシパルのテナントID xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx プリンシパルのテナント識別子。
プリンシパルタイプ アプリ プリンシパルの種類。"ユーザー"、"アプリ"、または "グループ" にすることができます。

次のステップ