I use New-AzureSBAuthorizationRule to create a new Shared Access Policy for an Azure Service Bus Queue. See command below...
New-AzureSBAuthorizationRule -EntityName abcdef -EntityType Queue -Permission Listen -Name "abcdef_reader" -Namespace abcdefnamespace
But every time I run this I get the error below:
New-AzureSBAuthorizationRule : Object reference not set to an instance of an object.
At line:1 char:1
+ New-AzureSBAuthorizationRule -EntityName abcdef -EntityType Queue -Permission ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureSBAuthorizationRule], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceBus.NewAzureSBAuthorizationRuleCommand
I am able to run New-AzureSBAuthorizationRule without issues if I drop EntityName and EntityType, i.e. creating policies for the Service Bus and not the Queue.
What am I doing wrong?
is it possible you're missing some syntax around the -Permission parameter? Here's an example of the PS command line given on MSDN:
C:\PS>New-AzureSBAuthorizationRule -Name MyRule -Namespace MyNamespace -Permission $("Manage", "Listen", "Send") -EntityName MyEntity -EntityType Queue -PrimaryKey P+lL/Mnd2Z9sj5hwMrRyAxQDdX8RHfbdqU2eIAqs1rc=
Looks like your parameter should be -Permission $("Listen")
Please let us know if that helps.
Regards, Seth Manheim Azure Doc Team