Azure Data Explorer を使用して Azure Monitor でデータのクエリを実行する (プレビュー)Query data in Azure Monitor using Azure Data Explorer (Preview)
Azure Data Explorer では、Azure Data Explorer、Application Insights (AI)、Log Analytics (LA) 間のクロス サービス クエリがサポートされています。The Azure Data Explorer supports cross-service queries between Azure Data Explorer, Application Insights (AI), and Log Analytics (LA). Azure Data Explorer のクエリ ツールを使用して Log Analytics または Application Insights ワークスペースに対してクロスサービス クエリでクエリを実行できます。You can query your Log Analytics or Application Insights workspace using Azure Data Explorer query tools and in a cross-service query. この記事では、クロスサービス クエリを作成する方法と、Azure Data Explorer の Web UI に Log Analytics または Application Insights のワークスペースを追加する方法について説明します。The article shows you how to create a cross-service query and add the Log Analytics or Application Insights workspace to the Azure Data Explorer Web UI.
Azure Data Explorer のクロスサービス クエリのフローは次のとおりです。The Azure Data Explorer cross-service queries flow:
注意
- Azure Data Explorer クライアント ツールを使用して直接、または Azure Data Explorer クラスターでクエリを実行することによって間接的に、Azure Data Explorer から Azure Monitor データに対してクエリを実行する機能は、プレビュー モードです。The ability to query Azure Monitor data from Azure Data Explorer, either directly using Azure Data Explorer client tools, or indirectly by running a query on an Azure Data Explorer cluster, is in preview mode.
- 支援が必要な場合は、クロス サービス クエリ チームにお問い合わせください。For assistance, contact the Cross service query team.
Azure Data Explorer クライアント ツールに Log Analytics/Application Insights ワークスペースを追加するAdd a Log Analytics/Application Insights workspace to Azure Data Explorer client tools
Log Analytics または Application Insights のワークスペースを Azure Data Explorer クライアント ツールに追加して、クラスターのクロスサービス クエリを有効にします。Add a Log Analytics or Application Insights workspace to Azure Data Explorer client tools to enable cross-service queries for your clusters.
Log Analytics または Application Insights クラスターに接続する前に、Azure Data Explorer ネイティブ クラスター (help クラスターなど) が左側のメニューに表示されていることを確認します。Verify your Azure Data Explorer native cluster (such as help cluster) appears on the left menu before you connect to your Log Analytics or Application Insights cluster.
Azure Data Explorer の UI (https://dataexplorer.azure.com/clusters) ) で、 [クラスターの追加] を選択します。In the Azure Data Explorer UI (https://dataexplorer.azure.com/clusters), select Add Cluster.
[クラスターの追加] ウィンドウで、LA または AI クラスターの URL を追加します。In the Add Cluster window, add the URL of the LA or AI cluster.
- LA の場合:
https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name>
For LA:https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name>
- AI の場合:
https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.insights/components/<ai-app-name>
For AI:https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.insights/components/<ai-app-name>
- LA の場合:
[追加] を選択します。Select Add.
ヒント
複数の Log Analytics または Application Insights ワークスペースへの接続を追加する場合は、それぞれに異なる名前を付けます。If you add a connection to more than one Log Analytics or Application insights workspace, give each a different name. そうしないと、左側のウィンドウですべてが同じ名前になります。Otherwise they'll all have the same name in the left pane.
接続が確立されると、Log Analytics または Application Insights のワークスペースが、ネイティブの Azure Data Explorer クラスターとともに左側のペインに表示されます。After the connection is established, your Log Analytics or Application Insights workspace will appear in the left pane with your native Azure Data Explorer cluster.
注意
マップできる Azure Monitor ワークスペースの数は、100 に制限されています。The number of Azure Monitor workspaces that can be mapped is limited to 100.
クエリを実行するRun queries
Kusto クエリをサポートするクライアント ツールを使用してクエリを実行できます。例:Kusto Explorer、Azure Data Explorer の Web UI、Jupyter Kqlmagic、Flow、PowerQuery、PowerShell、Lens、REST API。You can run the queries using client tools that support Kusto queries, such as: Kusto Explorer, Azure Data Explorer Web UI, Jupyter Kqlmagic, Flow, PowerQuery, PowerShell, Lens, REST API.
注意
クロスサービス クエリ機能は、データ取得のみに使用されます。The cross-service query ability is used for data retrieval only. 詳細については、「関数のサポート」を参照してください。For more information, see Function supportability.
ヒント
- データベースは、クロスサービス クエリで指定したリソースと同じ名前にする必要があります。The database should have the same name as the resource specified in the cross-service query. 名前は大文字と小文字が区別されます。Names are case sensitive.
- クロスサービス クエリでは、Application Insights アプリと Log Analytics ワークスペースの名前付けが正しいことを確認してください。In cross-service queries, make sure that the naming of Application Insights apps and Log Analytics workspaces is correct.
- 名前に特殊文字が含まれている場合は、クロスサービス クエリで URL エンコードに置き換えられます。If names contain special characters, they are replaced by URL encoding in the cross-service query.
- 名前に KQL 識別子の名前規則を満たしていない文字が含まれている場合は、ダッシュ - 文字で置き換えられます。If names include characters that don't meet KQL identifier name rules, they are replaced by the dash - character.
Azure Data Explorer クライアント ツールからの Log Analytics/Application Insights ワークスペースでの直接クエリDirect query on your Log Analytics or Application Insights workspaces from Azure Data Explorer client tools
Azure Data Explorer クライアント ツールから Log Analytics または Application Insights のワークスペースでクエリを実行できます。You can run queries on your Log Analytics or Application Insights workspaces from Azure Data Explorer client tools.
左側のペインでワークスペースが選択されていることを確認します。Verify that your workspace is selected in the left pane.
次のクエリを実行します。Run the following query:
Perf | take 10 // Demonstrate cross-service query on the Log Analytics workspace
Log Analytics または Application Insights のワークスペースと Azure Data Explorer ネイティブ クラスターのクロス クエリCross query of your Log Analytics or Application Insights workspace and the Azure Data Explorer native cluster
クロス クラスター サービス クエリを実行する場合は、左側のペインで Azure Data Explorer ネイティブ クラスターが選択されていることを確認してください。When you run cross cluster service queries, verify your Azure Data Explorer native cluster is selected in the left pane. 次の例では、Azure Data Explorer クラスター テーブルと Log Analytics ワークスペースを (union
を使用して) 結合する方法を示します。The following examples demonstrate combining Azure Data Explorer cluster tables (using union
) with a Log Analytics workspace.
次のクエリを実行します。Run the following queries:
union StormEvents, cluster('https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name>').database('<workspace-name>').Perf
| take 10
let CL1 = 'https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name>';
union <ADX table>, cluster(CL1).database(<workspace-name>).<table name>
ヒント
union の代わりに join
演算子を使用するには、それを Azure Data Explorer ネイティブ クラスターに対して実行するための hint
が必要になる場合があります。Using the join
operator, instead of union, may require a hint
to run it on an Azure Data Explorer native cluster.
一方のテナントの Azure Data Explorer クラスターのデータを他方の Azure Monitor リソースと結合するJoin data from an Azure Data Explorer cluster in one tenant with an Azure Monitor resource in another
サービス間のクロス テナント クエリはサポートされていません。Cross-tenant queries between the services aren't supported. 両方のリソースにまたがるクエリを実行するためには、1 つのテナントにサインインします。You are signed in to a single tenant for running the query spanning both resources.
Azure Data Explorer リソースがテナント 'A' にあり、Log Analytics ワークスペースがテナント 'B' にある場合は、次の 2 つの方法のいずれかを使用します。If the Azure Data Explorer resource is in Tenant 'A' and Log Analytics workspace is in Tenant 'B' use one of the following two methods:
Azure Data Explorer を使用すると、異なるテナントにプリンシパルのロールを追加できます。Azure Data Explorer allows you to add roles for principals in different tenants. Azure Data Explorer クラスターにテナント 'B' のユーザー ID を許可されているユーザーとして追加します。Add your user ID in Tenant 'B' as an authorized user on the Azure Data Explorer cluster. Azure Data Explorer クラスター上の 'TrustedExternalTenant' プロパティにテナント 'B' が含まれていることを検証します。Validate the 'TrustedExternalTenant' property on the Azure Data Explorer cluster contains Tenant 'B'. テナント 'B' でクロスクエリを完全に実行します。Run the cross-query fully in Tenant 'B'.
Lighthouse を使用して、Azure Monitor リソースをテナント 'A' に射影します。Use Lighthouse to project the Azure Monitor resource into Tenant 'A'.
さまざまなテナントから Azure Data Explorer クラスターに接続するConnect to Azure Data Explorer clusters from different tenants
Kusto Explorer では、ユーザー アカウントが最初に属しているテナントに自動的にサインインされます。Kusto Explorer automatically signs you into the tenant to which the user account originally belongs. 同じユーザー アカウントを使用して他のテナントのリソースにアクセスするには、接続文字列に tenantId
を明示的に指定する必要があります: Data Source=https://ade.applicationinsights.io/subscriptions/SubscriptionId/resourcegroups/ResourceGroupName;Initial Catalog=NetDefaultDB;AAD Federated Security=True;Authority ID=
TenantIdTo access resources in other tenants with the same user account, the tenantId
has to be explicitly specified in the connection string: Data Source=https://ade.applicationinsights.io/subscriptions/SubscriptionId/resourcegroups/ResourceGroupName;Initial Catalog=NetDefaultDB;AAD Federated Security=True;Authority ID=
TenantId
関数のサポートFunction supportability
Azure Data Explorer のクロスサービス クエリでは、Application Insights と Log Analytics の両方の関数がサポートされています。The Azure Data Explorer cross-service queries support functions for both Application Insights and Log Analytics. この機能により、クロス クラスター クエリで Azure Monitor の表形式関数を直接参照できます。This capability enables cross-cluster queries to reference an Azure Monitor tabular function directly. 次のコマンドがクロスサービス クエリでサポートされています。The following commands are supported with the cross-service query:
.show functions
.show function {FunctionName}
.show database {DatabaseName} schema as json
次の図は、Azure Data Explorer の Web UI から表形式関数にクエリを実行する例を示しています。The following image depicts an example of querying a tabular function from the Azure Data Explorer Web UI. 関数を使用するには、[クエリ] ウィンドウで名前を実行します。To use the function, run the name in the Query window.
その他の構文例Additional syntax examples
Application Insights または Log Analytics クラスターを呼び出す場合は、次の構文オプションを使用できます。The following syntax options are available when calling the Application Insights or Log Analytics clusters:
構文の説明Syntax Description | Application InsightsApplication Insights | Log AnalyticsLog Analytics |
---|---|---|
このサブスクリプションで定義されているリソースのみを含むクラスター内のデータベース (クロス クラスター クエリの場合に推奨)Database within a cluster that contains only the defined resource in this subscription (recommended for cross cluster queries) | cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.insights/components/<ai-app-name>').database('<ai-app-name> )cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.insights/components/<ai-app-name>').database('<ai-app-name> ) |
cluster(https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name>').database('<workspace-name> )cluster(https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name>').database('<workspace-name> ) |
このサブスクリプション内のすべてのアプリ/ワークスペースを含むクラスターCluster that contains all apps/workspaces in this subscription | cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id> )cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id> ) |
cluster(https://ade.loganalytics.io/subscriptions/<subscription-id> )cluster(https://ade.loganalytics.io/subscriptions/<subscription-id> ) |
サブスクリプション内のすべてのアプリ/ワークスペースを含み、このリソース グループのメンバーであるクラスターCluster that contains all apps/workspaces in the subscription and are members of this resource group | cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name> )cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name> ) |
cluster(https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name> )cluster(https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name> ) |
このサブスクリプションで定義されているリソースのみを含むクラスターCluster that contains only the defined resource in this subscription | cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.insights/components/<ai-app-name> )cluster(https://ade.applicationinsights.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.insights/components/<ai-app-name> ) |
cluster(https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name> )cluster(https://ade.loganalytics.io/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/microsoft.operationalinsights/workspaces/<workspace-name> ) |