functions/Set-ADXIngestionBatchingPolicy.ps1
function Set-ADXIngestionBatchingPolicy { [CmdletBinding()] param ( [Parameter(Mandatory)] $ClusterUrl, [Parameter(Mandatory)] $ApplicationClientID, [Parameter(Mandatory)] $ApplicationClientKey, [Parameter(Mandatory)] $Authority, [Parameter(Mandatory)] $Seconds, [Parameter(Mandatory)] $DatabaseName, [Parameter(Mandatory)] $TableName ) try { $KustoConnectionStringBuilder = [Kusto.Data.KustoConnectionStringBuilder]::new($ClusterUrl).WithAadApplicationKeyAuthentication( $ApplicationClientID, $ApplicationClientKey, $Authority ) $KustoClient = [Kusto.Data.Net.Client.KustoClientFactory]::CreateCslAdminProvider($KustoConnectionStringBuilder) $MaximumBatchingTimeSpan = [system.timespan]::FromSeconds($Seconds) $IngestionBatchingPolicy = [kusto.Data.IngestionBatchingPolicy]::new($MaximumBatchingTimeSpan, 100, 1024) $CslCommandGenerator = [Kusto.Data.Common.CslCommandGenerator]::GenerateTableAlterIngestionBatchingPolicyCommand( $DatabaseName, $TableName, $IngestionBatchingPolicy ) $KustoClient.ExecuteControlCommand($CslCommandGenerator) } catch { Write-Error $($_.Exception) } } |