@@ -3,7 +3,7 @@ title: Use follower database feature to attach databases in Azure Data Explorer
33description : Learn about how to attach databases in Azure Data Explorer using the follower database feature.
44ms.reviewer : gabilehner
55ms.topic : how-to
6- ms.date : 06/10 /2025
6+ ms.date : 12/11 /2025
77ms.custom :
88 - devx-track-azurepowershell
99 - sfi-image-nochange
@@ -99,43 +99,26 @@ You can optionally make the database name in the follower cluster different from
9999### C\# example
100100
101101``` csharp
102- var tenantId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ; // Directory (tenant) ID
103- var clientId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ; // Application ID
104- var clientSecret = " PlaceholderClientSecret" ; // Client Secret
105- var followerSubscriptionId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ;
106- var credentials = new ClientSecretCredential (tenantId , clientId , clientSecret );
107- var resourceManagementClient = new ArmClient (credentials , followerSubscriptionId );
108- var followerResourceGroupName = " followerResourceGroup" ;
109- var followerClusterName = " follower" ;
110- var subscription = await resourceManagementClient .GetDefaultSubscriptionAsync ();
111- var resourceGroup = (await subscription .GetResourceGroupAsync (followerResourceGroupName )).Value ;
112- var cluster = (await resourceGroup .GetKustoClusterAsync (followerClusterName )).Value ;
113- var attachedDatabaseConfigurations = cluster .GetKustoAttachedDatabaseConfigurations ();
114- var attachedDatabaseConfigurationName = " attachedDatabaseConfiguration"
115- var leaderSubscriptionId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ;
116- var leaderResourceGroup = " leaderResourceGroup" ;
117- var leaderClusterName = " leader" ;
118- var attachedDatabaseConfigurationData = new KustoAttachedDatabaseConfigurationData
119- {
120- ClusterResourceId = new ResourceIdentifier ($" /subscriptions/{leaderSubscriptionId }/resourceGroups/{leaderResourceGroup }/providers/Microsoft.Kusto/Clusters/{leaderClusterName }" ),
121- DatabaseName = " <databaseName>" , // Can be a specific database name in a leader cluster or * for all databases
122- DefaultPrincipalsModificationKind = KustoDatabaseDefaultPrincipalsModificationKind .Union ,
123- Location = AzureLocation .NorthCentralUS
124- };
125- // Table level sharing properties are not supported when using '*' all databases notation.
126- if (attachedDatabaseConfigurationData .DatabaseName != " *" )
127- {
128- // Set up the table level sharing properties - the following is just an example.
129- attachedDatabaseConfigurationData .TableLevelSharingProperties = new KustoDatabaseTableLevelSharingProperties ();
130- attachedDatabaseConfigurationData .TableLevelSharingProperties .TablesToInclude .Add (" table1" );
131- attachedDatabaseConfigurationData .TableLevelSharingProperties .TablesToExclude .Add (" table2" );
132- attachedDatabaseConfigurationData .TableLevelSharingProperties .ExternalTablesToExclude .Add (" exTable1" );
133- attachedDatabaseConfigurationData .TableLevelSharingProperties .ExternalTablesToInclude .Add (" exTable2" );
134- attachedDatabaseConfigurationData .TableLevelSharingProperties .MaterializedViewsToInclude .Add (" matTable1" );
135- attachedDatabaseConfigurationData .TableLevelSharingProperties .MaterializedViewsToExclude .Add (" matTable2" );
136- attachedDatabaseConfigurationData .TableLevelSharingProperties .FunctionsToInclude .Add (" func1" );
137- attachedDatabaseConfigurationData .TableLevelSharingProperties .FunctionsToExclude .Add (" func2" );
138- }
102+ var followerClusterId = KustoClusterResource .CreateResourceIdentifier (subscriptionId : " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" , resourceGroupName : " followerResourceGroup" , clusterName : " follower" );
103+ var leaderClusterId = KustoClusterResource .CreateResourceIdentifier (subscriptionId : " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" , resourceGroupName : " leaderResourceGroup" , clusterName : " leader" );
104+ var attachedDatabaseConfigurationName = " attachedDatabaseConfiguration" ;
105+ var credentials = new ManagedIdentityCredential ();
106+ var resourceManagementClient = new ArmClient (credentials );
107+ var followerCluster = resourceManagementClient .GetKustoClusterResource (followerClusterId );
108+ var attachedDatabaseConfigurations = followerCluster .GetKustoAttachedDatabaseConfigurations ();
109+ var attachedDatabaseConfigurationData = new KustoAttachedDatabaseConfigurationData { ClusterResourceId = leaderClusterId , DatabaseName = " " , // Can be a specific database name in a leader cluster or * for all databases
110+ DefaultPrincipalsModificationKind = KustoDatabaseDefaultPrincipalsModificationKind .Union , Location = AzureLocation .NorthCentralUS }; // Table level sharing properties are not supported when using '*' all databases notation.
111+ if (attachedDatabaseConfigurationData .DatabaseName != " *" )
112+ { // Set up the table level sharing properties - the following is just an example.
113+ attachedDatabaseConfigurationData .TableLevelSharingProperties = new KustoDatabaseTableLevelSharingProperties ();
114+ attachedDatabaseConfigurationData .TableLevelSharingProperties .TablesToInclude .Add (" table1" );
115+ attachedDatabaseConfigurationData .TableLevelSharingProperties .TablesToExclude .Add (" table2" );
116+ attachedDatabaseConfigurationData .TableLevelSharingProperties .ExternalTablesToExclude .Add (" exTable1" );
117+ attachedDatabaseConfigurationData .TableLevelSharingProperties .ExternalTablesToInclude .Add (" exTable2" );
118+ attachedDatabaseConfigurationData .TableLevelSharingProperties .MaterializedViewsToInclude .Add (" matTable1" );
119+ attachedDatabaseConfigurationData .TableLevelSharingProperties .MaterializedViewsToExclude .Add (" matTable2" );
120+ attachedDatabaseConfigurationData .TableLevelSharingProperties .FunctionsToInclude .Add (" func1" );
121+ attachedDatabaseConfigurationData .TableLevelSharingProperties .FunctionsToExclude .Add (" func2" ); }
139122await attachedDatabaseConfigurations .CreateOrUpdateAsync (WaitUntil .Completed , attachedDatabaseConfigurationName , attachedDatabaseConfigurationData );
140123```
141124
0 commit comments