Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer
Changes the reference of the query to a remote cluster. To access a database within the same cluster, use the database() function. For more information, see cross-database and cross-cluster queries.
Changes the reference of the query to a remote Eventhouse. To access a database within the same Eventhouse, use the database() function. For more information, see cross-database and cross-cluster queries.
Syntax
cluster(name)
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description | 
|---|---|---|---|
| name | string | ✔️ | The name of the cluster to reference. The value can be specified as a fully qualified domain name, or the name of the cluster without the .kusto.windows.netsuffix. The cluster name is treated as case-insenstive and the recommendation is to provide it lower-case. The value can't be the result of subquery evaluation. | 
| Name | Type | Required | Description | 
|---|---|---|---|
| name | string | ✔️ | The full URL of the Eventhouse to reference. The value can be specified as a fully qualified domain name, or the name of the Eventhouse. The Eventhouse name is treated as case-insenstive and the recommendation is to provide it lower-case. The value can't be the result of subquery evaluation. | 
Examples
The following example shows how to use the cluster() function to access a remote cluster.
The query can be run on any cluster.
cluster('help').database('Samples').StormEvents | count
cluster('help.kusto.windows.net').database('Samples').StormEvents | count
The following example shows how to use the cluster() function to access a remote Eventhouse.
The query can be run on any Eventhouse.
cluster('help').database('Samples').StormEvents | count
cluster('help.kusto.windows.net').database('Samples').StormEvents | count
Output
| Count | 
|---|
| 59066 | 
The previous query can be rewritten to use a query-defined function (let statement) that takes a parameter called clusterName and passes it to the cluster() function.
let foo = (clusterName:string)
{
    cluster(clusterName).database('Samples').StormEvents | count
};
foo('help')
Output
| Count | 
|---|
| 59066 | 
The same query as above can be rewritten to be used in a function that receives a parameter clusterName - which is passed into the cluster() function.
.create function foo(clusterName:string)
{
    cluster(clusterName).database('Samples').StormEvents | count
};
Note
Stored functions using the cluster() function can't be used in cross-cluster queries.
Note
Stored functions using the cluster() function can't be used in cross-Eventhouse queries.