How-To dynamically add partitions

It means “Update the value of the partition count”.

Using the Resource Manager Template

{ "apiVersion": "2017-04-01", "type": "Microsoft.EventHub/namespaces/eventhubs", "name": "[concat(parameters('namespaceName'), '/', parameters('eventHubName'))]", "location": "[parameters('location')]", "dependsOn": [ "[resourceId('Microsoft.EventHub/namespaces', parameters('namespaceName'))]" ], "properties": { "messageRetentionInDays": 7, "partitionCount": 12 } }

Using PowerShell

Use the Set-AzEventHub PowerShell command to update partitions in an event hub.

Example 1

Set-AzEventHub -ResourceGroupName MyResourceGroupName -Namespace MyNamespaceName -Name MyEventHubName -InputObject MyCreatedEventHub -messageRetentionInDays 4 -partitionCount 2

Example 2

$createdEventHub = Get-AzEventHub -ResourceGroupName MyResourceGroupName -Namespace MyNamespaceName -Name MyCreatedEventHub $ceatedEventHub.CaptureDescription = New-Object -TypeName Microsoft.Azure.Commands.EventHub.Models.PSCaptureDescriptionAttributes $createdEventHub.CaptureDescription.Enabled = $true $createdEventHub.CaptureDescription.IntervalInSeconds = 120 $createdEventHub.CaptureDescription.Encoding = "Avro" $createdEventHub.CaptureDescription.SizeLimitInBytes = 10485763 $createdEventHub.CaptureDescription.Destination.Name = "EventHubArchive.AzureBlockBlob" $createdEventHub.CaptureDescription.Destination.BlobContainer = "container" $createdEventHub.CaptureDescription.Destination.ArchiveNameFormat = "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}" $createdEventHub.CaptureDescription.Destination.StorageAccountResourceId = "/subscriptions/{SubscriptionId}/resourceGroups/MyResourceGroupName/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage" Set-AzEventHub -ResourceGroupName MyResourceGroupName -Namespace MyNamespaceName -Name MyEventHubName -InputObject $createdEventHub