@@ -99,26 +99,37 @@ You can optionally make the database name in the follower cluster different from
9999### C\# example
100100
101101``` csharp
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" ); }
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+
106+ var credentials = new ManagedIdentityCredential ();
107+ var resourceManagementClient = new ArmClient (credentials );
108+ var followerCluster = resourceManagementClient .GetKustoClusterResource (followerClusterId );
109+ var attachedDatabaseConfigurations = followerCluster .GetKustoAttachedDatabaseConfigurations ();
110+ var attachedDatabaseConfigurationData = new KustoAttachedDatabaseConfigurationData
111+ {
112+ ClusterResourceId = leaderClusterId ,
113+ DatabaseName = " <databaseName>" , // Can be a specific database name in a leader cluster or * for all databases
114+ DefaultPrincipalsModificationKind = KustoDatabaseDefaultPrincipalsModificationKind .Union ,
115+ Location = AzureLocation .NorthCentralUS
116+ };
117+
118+ // Table level sharing properties are not supported when using '*' all databases notation.
119+ if (attachedDatabaseConfigurationData .DatabaseName != " *" )
120+ {
121+ // Set up the table level sharing properties - the following is just an example.
122+ attachedDatabaseConfigurationData .TableLevelSharingProperties = new KustoDatabaseTableLevelSharingProperties ();
123+ attachedDatabaseConfigurationData .TableLevelSharingProperties .TablesToInclude .Add (" table1" );
124+ attachedDatabaseConfigurationData .TableLevelSharingProperties .TablesToExclude .Add (" table2" );
125+ attachedDatabaseConfigurationData .TableLevelSharingProperties .ExternalTablesToExclude .Add (" exTable1" );
126+ attachedDatabaseConfigurationData .TableLevelSharingProperties .ExternalTablesToInclude .Add (" exTable2" );
127+ attachedDatabaseConfigurationData .TableLevelSharingProperties .MaterializedViewsToInclude .Add (" matTable1" );
128+ attachedDatabaseConfigurationData .TableLevelSharingProperties .MaterializedViewsToExclude .Add (" matTable2" );
129+ attachedDatabaseConfigurationData .TableLevelSharingProperties .FunctionsToInclude .Add (" func1" );
130+ attachedDatabaseConfigurationData .TableLevelSharingProperties .FunctionsToExclude .Add (" func2" );
131+ }
132+
122133await attachedDatabaseConfigurations .CreateOrUpdateAsync (WaitUntil .Completed , attachedDatabaseConfigurationName , attachedDatabaseConfigurationData );
123134```
124135
@@ -430,20 +441,12 @@ To verify that the database was successfully attached, find your attached databa
430441The follower cluster can detach any attached follower database as follows:
431442
432443```csharp
433- var tenantId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Directory (tenant) ID
434- var clientId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx"; //Application ID
435- var clientSecret = "PlaceholderClientSecret"; //Client Secret
436- var followerSubscriptionId = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx";
437- var credentials = new ClientSecretCredential(tenantId, clientId, clientSecret);
438- var resourceManagementClient = new ArmClient(credentials, followerSubscriptionId);
439- var followerResourceGroupName = "testrg";
440- //The cluster and database attached database configuration are created as part of the prerequisites
441- var followerClusterName = "follower";
442- var attachedDatabaseConfigurationsName = "attachedDatabaseConfiguration";
443- var subscription = await resourceManagementClient.GetDefaultSubscriptionAsync();
444- var resourceGroup = (await subscription.GetResourceGroupAsync(followerResourceGroupName)).Value;
445- var cluster = (await resourceGroup.GetKustoClusterAsync(followerClusterName)).Value;
446- var attachedDatabaseConfiguration = (await cluster.GetKustoAttachedDatabaseConfigurationAsync(attachedDatabaseConfigurationsName)).Value;
444+ var attachedDatabaseConfigurationId = KustoAttachedDatabaseConfigurationResource.CreateResourceIdentifier(
445+ subscriptionId: "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx", resourceGroupName: "testrg", clusterName: "follower",
446+ attachedDatabaseConfigurationName: "attachedDatabaseConfiguration");
447+ var credentials = new ManagedIdentityCredential();
448+ var resourceManagementClient = new ArmClient(credentials);
449+ var attachedDatabaseConfiguration = resourceManagementClient.GetKustoAttachedDatabaseConfigurationResource(attachedDatabaseConfigurationId);
447450await attachedDatabaseConfiguration.DeleteAsync(WaitUntil.Completed);
448451```
449452
@@ -452,27 +455,16 @@ await attachedDatabaseConfiguration.DeleteAsync(WaitUntil.Completed);
452455The leader cluster can detach any attached database as follows:
453456
454457``` csharp
455- var tenantId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ; // Directory (tenant) ID
456- var clientId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ; // Application ID
457- var clientSecret = " PlaceholderClientSecret" ; // Client Secret
458- var leaderSubscriptionId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ;
459- var credentials = new ClientSecretCredential (tenantId , clientId , clientSecret );
460- var resourceManagementClient = new ArmClient (credentials , leaderSubscriptionId );
461- var leaderResourceGroupName = " testrg" ;
462- var leaderClusterName = " leader" ;
463- var subscription = await resourceManagementClient .GetDefaultSubscriptionAsync ();
464- var resourceGroup = (await subscription .GetResourceGroupAsync (leaderResourceGroupName )).Value ;
465- var cluster = (await resourceGroup .GetKustoClusterAsync (leaderClusterName )).Value ;
466- var followerSubscriptionId = " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" ;
467- var followerResourceGroupName = " followerResourceGroup" ;
468- // The cluster and attached database configuration that are created as part of the Prerequisites
469- var followerClusterName = " follower" ;
470- var attachedDatabaseConfigurationsName = " attachedDatabaseConfiguration" ;
458+ var leaderClusterId = KustoClusterResource .CreateResourceIdentifier (subscriptionId : " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" , resourceGroupName : " testrg" , clusterName : " leader" );
459+ var followerClusterId = KustoClusterResource .CreateResourceIdentifier (subscriptionId : " xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxx" , resourceGroupName : " followerResourceGroup" , clusterName : " follower" );
471460var followerDatabaseDefinition = new KustoFollowerDatabaseDefinition (
472- clusterResourceId : new ResourceIdentifier ( $" /subscriptions/{ followerSubscriptionId }/resourceGroups/{ followerResourceGroupName }/providers/Microsoft.Kusto/Clusters/{ followerClusterName } " ) ,
473- attachedDatabaseConfigurationName : attachedDatabaseConfigurationsName
461+ clusterResourceId : followerClusterId ,
462+ attachedDatabaseConfigurationName : ( string ? ) " attachedDatabaseConfiguration "
474463);
475- await cluster .DetachFollowerDatabasesAsync (WaitUntil .Completed , followerDatabaseDefinition );
464+ var credentials = new ManagedIdentityCredential ();
465+ var resourceManagementClient = new ArmClient (credentials );
466+ var leaderCluster = resourceManagementClient .GetKustoClusterResource (leaderClusterId );
467+ await leaderCluster .DetachFollowerDatabasesAsync (WaitUntil .Completed , followerDatabaseDefinition );
476468```
477469
478470## [ Python] ( #tab/python )
0 commit comments