PowerShell script to get the total number of partitions in Event Hub Namespace
Scenario: PowerShell script to get the total number of partitions in Event Hub Namespace.
You must be wondering how to find out total number of partition count for any Event Hub namespace??
On the Azure portal you can only see partition count per Event Hub Entity level but not Namespace level. It’s tiresome job to manually sum up partition counts of all the entities especially when you have hundreds of event hub entities under the namespace.
Here is a simple way to find out total number of Partitions under Event Hub namespace using PowerShell script.
Solution:
Use below PowerShell script to see the total number of Partitions under your namespace.
Please find below steps on how to run the PowerShell script to see total number of partitions in an Event Hub namespace over Azure Portal:
Step 1: Login to Azure portal
Step 2: Open Azure PowerShell terminal and connect to your Azure account using any of options mentioned in Authentication Methods
Step 3: Run the above mentioned PowerShell script by replacing your Resource Group, Event Hub Namespace details accordingly.
Step 4: You will be seeing total number of partition count under Event Hub namespace in Result as below. (Highlighted in RED box)
This script allows you to quickly check the total number of partitions under Event Hub namespace and take necessary actions like increasing PU’s/ CU’s if it is reaching quota limit.
You can also create an Alert using this PowerShell script by putting a threshold value near to Quota limit & proactively act on increasing PU’s/ CU’s if it is reaching quota limit.
In Premium and Dedicated tiers of Event Hub, there is a limitation on partition count per PU/ CU at namespace level.
Below are the quotas and limits on Partitions and Event Hub entities per namespace level.
Limit |
Basic |
Standard |
Premium |
Dedicated |
Number of partitions per event hub |
32 |
32 |
100 per event hub, but there's a limit of 200 per PU at the namespace level.
|
1024 per event hub |
Number of event hubs per namespace |
10 |
10 |
100 per PU |
1000 |
When you try to create a new Event Hub exceeding partitions limit on Namespace level, it throws below error.
To avoid getting these errors especially when you are in PRODUCTION environment/ using automatic script to create Event Hub entities, this script helps to proactively check if current partition count nearing Quota limit.
Reference Links:
Quotas and limits - Azure Event Hubs - Azure Event Hubs | Microsoft Learn
Published on:
Learn more