Has anyone managed to create an Authorization Rule on either a Notification Hub or Notification Hub Namespace using New-AzNotificationHubAuthorizationRule or New-AzNotificationHubsNamespaceAuthorizationRule? I'm having trouble finding a decent example?
The documentation specifies
{
"Name": "ContosoAuthorizationRule",
"PrimaryKey": "WE4qH0398AyXjlekt56gg1gMR3NHoMs29KkUnnpUk01Y=",
"Rights": [
"Listen",
"Send"
]
}
Where would the Primary Key come from?
I can't find any examples online except the official docs and they're rather sparse on detail.
The primary key
is described in the end of Description section:
The PrimaryKey that is used for authentication, can be randomly generated by using the following Windows PowerShell command: [Convert]::ToBase64String((1..32 |% { [byte/](Get-Random -Minimum 0 -Maximum 255) }))
But note that there is a minor error in the command, you should use [byte]
instead of [byte/]
in the above code.
Then you can use the command New-AzNotificationHubsNamespaceAuthorizationRule
to create a namespace level rule: