Skip to content

Commit bcadf23

Browse files
authored
feat(credentials): Microsoft app credentials for Power BI and Azure Data Explorer, with national clouds (#9931)
* feat(credentials): resource-aware Microsoft app tokens and an optional national cloud Microsoft app credentials resolve each service's token audience from one table and cache minted tokens per credential, stored-secret version, and audience, so services that need a different resource no longer share a Graph-or-Dataverse key. A credential can name a national cloud (US Government GCC High or DoD, or China); its Entra endpoint, certificate assertion audience, and save-time Graph check follow that cloud. Global credentials store no cloud field, so existing secrets and older workers read them exactly as before, and Graph and Dataverse services refuse a national-cloud credential because their tools call the global cloud. * feat(powerbi): run Power BI as a Microsoft app credential The Power BI service offers the Microsoft app credential beside its delegated OAuth connection. A run or selector with an app credential gets an app-only token for the Power BI REST API audience (https://analysis.windows.net/powerbi/api/.default), cached apart from the credential's Graph token; national-cloud credentials are refused because the tools call api.powerbi.com. Delegated connections and every tool's params are unchanged. The Power BI integration suite proves a run and a selector end to end with a persisted app credential. * feat(azure-data-explorer): run as a saved Microsoft app credential Adds azure_data_explorer_v2, a credential-only successor whose picker selects a Microsoft app credential (client secret, certificate, or keyless federated credential) in place of the inline tenant ID, client ID, and client secret. The executor authorizes the credential and the operation mints a token for the cluster each call names: the audience is the allowlisted cluster (or resource override) host as https://<host>, and the credential's cloud must be one that host belongs to, so a US Government or China cluster takes a matching national-cloud credential. Inline secrets are never read on that path. The legacy block keeps its inline fields and behavior and is marked legacy with azure_data_explorer_v2 as its replacement. The connect dialog gains a Cloud choice; a global credential's payload and stored secret are unchanged. * fix(credentials): decrypt Microsoft app secrets only on a token miss and scope the ADX operation - Token cache key is named before decrypting, so a cached token skips the decrypt and parse; Azure Data Explorer authorization no longer decrypts, and its cluster key includes the resource's clouds. - The ADX operation re-checks the credential against the run's workspace or organization, as the AWS operation path does. - A credential in the wrong Microsoft cloud is refused as cloud_mismatch with its own message instead of "reconnect the credential"; ADX tool errors come from the refusal code, not log detail. - The operation-minted service comes from the shared ADX credential config. - Reconnect reopens a national-cloud credential on its stored cloud. - China signs in at login.partner.microsoftonline.cn (Entra national-cloud reference) for both ADX auth paths; Kusto authorities derive from MICROSOFT_CLOUDS. - Drop the one-line ADX operations passthrough; refresh TSDoc and the Power BI description. * fix(credentials): refuse a national-cloud Microsoft app credential for Dataverse as a cloud mismatch * refactor(credentials): read a reconnect's stored mode and cloud through one per-provider map * fix(credentials): resolve a reconnect's cloud before saving and refuse a cross-cloud ADX resource A Microsoft app reconnect now waits for the stored cloud, or asks for one when it cannot be read (an organization credential or a failed lookup), instead of saving as global. The ADX schema refuses a resource override whose cloud differs from the cluster's before any credential is decrypted, and the Power BI description says app credentials run in the global cloud only.
1 parent 7d5641d commit bcadf23

51 files changed

Lines changed: 1463 additions & 232 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/docs/components/ui/icon-mapping.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
361361
athena_v2: AthenaIcon,
362362
attio: AttioIcon,
363363
azure_data_explorer: AzureDataExplorerIcon,
364+
azure_data_explorer_v2: AzureDataExplorerIcon,
364365
azure_devops: AzureIcon,
365366
azure_devops_v2: AzureIcon,
366367
bitbucket: BitbucketIcon,

‎apps/docs/content/docs/integrations/azure_data_explorer.mdx‎

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Azure Data Explorer
33
description: Query and manage Azure Data Explorer (Kusto) clusters with KQL
44
integration:
5-
type: "azure_data_explorer"
5+
type: "azure_data_explorer_v2"
66
color: "#FFFFFF"
77
---
88

@@ -32,7 +32,7 @@ In Sim, this integration gives your agents both halves:
3232
- **Debug the pipeline** — list ingestion failures with their error codes and root causes, and check the state of a long-running operation
3333
- **Run any management command** — the escape hatch for policies, mappings, and anything else on the control plane
3434

35-
Authentication uses a **Microsoft Entra service principal** (an app registration with a tenant ID, client ID, and client secret) rather than an interactive sign-in, so scheduled and unattended workflows keep working without anyone logging in. Grant that principal access to the database with `.add database <DATABASE> viewers ('aadapp=<clientId>;<tenantId>')` — use `viewers` for read-only agents, and `ingestors` or `users` only when a workflow needs to write.
35+
Authentication uses a **Microsoft Entra app registration** rather than an interactive sign-in, so scheduled and unattended workflows keep working without anyone logging in. Select a saved [Microsoft app credential](/integrations/microsoft-app-credentials), which signs in with a client secret, a certificate, or a keyless federated credential; choose the credential's cloud to match the cluster (a `kusto.usgovcloudapi.net` cluster needs a US Government credential, a `kusto.chinacloudapi.cn` one a China credential). Sim mints a token for the cluster itself (`https://<cluster host>`) on each run. Grant the app access to the database with `.add database <DATABASE> viewers ('aadapp=<clientId>;<tenantId>')` — use `viewers` for read-only agents, and `ingestors` or `users` only when a workflow needs to write. Workflows built before saved credentials keep their inline tenant ID, client ID, and client secret.
3636

3737
A few things worth knowing before you build:
3838

@@ -46,7 +46,7 @@ A few things worth knowing before you build:
4646

4747
## Use the block [#usage-instructions]
4848

49-
Run Kusto Query Language queries against Azure Data Explorer and Fabric Eventhouse clusters, discover databases, tables, and schemas, push small batches of rows inline, and run management commands. Authenticates with a Microsoft Entra service principal using client credentials, so no interactive sign-in is needed.
49+
Run Kusto Query Language queries against Azure Data Explorer and Fabric Eventhouse clusters, discover databases, tables, and schemas, push small batches of rows inline, and run management commands. Runs as a Microsoft app credential: an app registration signing in with a client secret, a certificate, or a keyless federated credential, in the global cloud or a national cloud, so no interactive sign-in is needed.
5050

5151
## Actions
5252

@@ -61,9 +61,6 @@ Run a Kusto Query Language (KQL) query against an Azure Data Explorer database a
6161
| Parameter | Type | Required | Description |
6262
| --------- | ---- | -------- | ----------- |
6363
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
64-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
65-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
66-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
6764
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
6865
| `database` | string | Yes | Database to run the query against |
6966
| `query` | string | Yes | KQL query text \(e.g., StormEvents \| where State == "FLORIDA" \| summarize count\(\) by EventType\) |
@@ -98,9 +95,6 @@ Run an Azure Data Explorer management command (a control command starting with "
9895
| Parameter | Type | Required | Description |
9996
| --------- | ---- | -------- | ----------- |
10097
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
101-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
102-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
103-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
10498
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
10599
| `command` | string | Yes | Management command text, starting with "." \(e.g., .show table Events details\) |
106100
| `database` | string | No | Database context for the command. Required for all commands except cluster-level ones such as .show databases |
@@ -133,9 +127,6 @@ List the databases on an Azure Data Explorer cluster that the service principal
133127
| Parameter | Type | Required | Description |
134128
| --------- | ---- | -------- | ----------- |
135129
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
136-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
137-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
138-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
139130
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
140131

141132
#### Output
@@ -167,9 +158,6 @@ List the tables in an Azure Data Explorer database, with their folder and docstr
167158
| Parameter | Type | Required | Description |
168159
| --------- | ---- | -------- | ----------- |
169160
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
170-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
171-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
172-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
173161
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
174162
| `database` | string | Yes | Database whose tables should be listed |
175163

@@ -202,9 +190,6 @@ Read the column schema of an Azure Data Explorer table in CSL form (e.g., "Times
202190
| Parameter | Type | Required | Description |
203191
| --------- | ---- | -------- | ----------- |
204192
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
205-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
206-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
207-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
208193
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
209194
| `database` | string | Yes | Database containing the table |
210195
| `table` | string | Yes | Table whose schema should be read |
@@ -232,9 +217,6 @@ Read the full schema of an Azure Data Explorer database as a flat list of every
232217
| Parameter | Type | Required | Description |
233218
| --------- | ---- | -------- | ----------- |
234219
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
235-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
236-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
237-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
238220
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
239221
| `database` | string | Yes | Database whose schema should be read |
240222

@@ -266,9 +248,6 @@ Read size, row count, hot-cache footprint, and effective policies for a table
266248
| Parameter | Type | Required | Description |
267249
| --------- | ---- | -------- | ----------- |
268250
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
269-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
270-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
271-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
272251
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
273252
| `database` | string | Yes | Database to read table details from |
274253
| `table` | string | No | Table to describe. Omit to describe every table in the database |
@@ -301,9 +280,6 @@ List the stored functions in an Azure Data Explorer database, with their paramet
301280
| Parameter | Type | Required | Description |
302281
| --------- | ---- | -------- | ----------- |
303282
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
304-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
305-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
306-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
307283
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
308284
| `database` | string | Yes | Database whose stored functions should be listed |
309285

@@ -336,9 +312,6 @@ Push rows directly into an Azure Data Explorer table with .ingest inline. Data i
336312
| Parameter | Type | Required | Description |
337313
| --------- | ---- | -------- | ----------- |
338314
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
339-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
340-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
341-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
342315
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
343316
| `database` | string | Yes | Database containing the target table |
344317
| `table` | string | Yes | Table to ingest into. Its schema is the assumed schema for the data |
@@ -374,9 +347,6 @@ Materialize the result of a KQL query into a table with .set, .append, .set-or-a
374347
| Parameter | Type | Required | Description |
375348
| --------- | ---- | -------- | ----------- |
376349
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
377-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
378-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
379-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
380350
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
381351
| `database` | string | Yes | Database containing the target table |
382352
| `table` | string | Yes | Table to ingest the query result into |
@@ -413,9 +383,6 @@ Create a table in an Azure Data Explorer database from a CSL column schema. Succ
413383
| Parameter | Type | Required | Description |
414384
| --------- | ---- | -------- | ----------- |
415385
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
416-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
417-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
418-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
419386
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
420387
| `database` | string | Yes | Database to create the table in |
421388
| `table` | string | Yes | Name of the table to create |
@@ -450,9 +417,6 @@ Drop a table from an Azure Data Explorer database. The table becomes unavailable
450417
| Parameter | Type | Required | Description |
451418
| --------- | ---- | -------- | ----------- |
452419
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
453-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
454-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
455-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
456420
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
457421
| `database` | string | Yes | Database containing the table |
458422
| `table` | string | Yes | Name of the table to drop |
@@ -487,9 +451,6 @@ List ingestion failures recorded for a database, with the failing table, error c
487451
| Parameter | Type | Required | Description |
488452
| --------- | ---- | -------- | ----------- |
489453
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
490-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
491-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
492-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
493454
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
494455
| `database` | string | Yes | Database whose ingestion failures should be listed |
495456
| `operationId` | string | No | Limit results to a single ingestion operation ID |
@@ -522,9 +483,6 @@ Check the state of administrative operations on a cluster, such as an async inge
522483
| Parameter | Type | Required | Description |
523484
| --------- | ---- | -------- | ----------- |
524485
| `clusterUri` | string | Yes | Cluster URI \(e.g., https://mycluster.eastus.kusto.windows.net) |
525-
| `tenantId` | string | Yes | Microsoft Entra tenant ID hosting the service principal |
526-
| `clientId` | string | Yes | Microsoft Entra application \(client\) ID |
527-
| `clientSecret` | string | Yes | Microsoft Entra application client secret |
528486
| `resource` | string | No | Token audience override. Defaults to the cluster URI itself |
529487
| `database` | string | No | Database context for the command |
530488
| `operationId` | string | No | Operation ID to check, e.g. the ID returned by an async ingestion |

0 commit comments

Comments
 (0)