Reputation: 4731
I am trying to get the Azure Event hub connection string by using PowerShell script (ps1 file) but it's coming with primary and secondary connection strings How Do I separate these values? I am only interested primary connection string
this the document I am using powershell
Get-AzEventHubKey -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -EventHubName MyEventHubName -AuthorizationRuleName MyAuthRuleName
Upvotes: 0
Views: 109
Reputation: 4778
Thanks Dai & Toni for your suggestion it helps lot to fix the issue.
Use Select-Object to select the specific property of the result.
Get-AzEventHubKey -ResourceGroupName < Resource Group Name> -NamespaceName < Event Hub Namespace Name> -EventHubName < Event Hub Name>-AuthorizationRuleName < Authorization Rule Name> | Select-Object -Property primaryConnectionString
If you are planning using CLI use -query
property to select the specific property of the result
az eventhubs eventhub authorization-rule keys list --resource-group < Resource Group Name> --namespace-name < Event Hub Namespace Name > --eventhub-name < Event Hub Name> --name < Rule Name > --query "primaryConnectionString"
Upvotes: 1