Search code examples
azureazure-powershellazure-notificationhub

How do I retrieve the endpoint of an Azure Notification Hub Access policy using powershell?


I have a need to programmatically, using Powershell, retrieve the endpoint of a NotificationHub Access Policy.

I have tried Get-AzNotificationHubsListKey from https://learn.microsoft.com/en-us/powershell/module/az.notificationhubs/get-aznotificationhubauthorizationrule?view=azps-5.4.0:

$ruleKey = Get-AzNotificationHubsListKey `
  -ResourceGroup $resourceGroupName `
  -Namespace $notificationsHubNamespace `
  -NotificationHub $notificationHub `
  -AuthorizationRule $ruleName

But this throws the error:

Get-AzNotificationHubsListKey: The term 'Get-AzNotificationHubsListKey' is not recognized as a name of a cmdlet, function, script file, or executable program.

Can anyone give me a hand?


Solution

  • It looks like you have a typo in your command. Based on docs, it should be Get-AzNotificationHubListKey, while you have Get-AzNotificationHubSListKey.