Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Powershell: How to create/Manage Shared Access Policy for a Service Bus queue

$
0
0

Am able to create the queue with the below code,

$queuename = "samplequeue"
$CurrentNamespace = Get-AzureSBNamespace -Name "mynamespace"
$NamespaceManager = [Microsoft.ServiceBus.NamespaceManager]::CreateFromConnectionString($CurrentNamespace.ConnectionString);
$QueueDescription = New-Object -TypeName Microsoft.ServiceBus.Messaging.QueueDescription -ArgumentList $queuename
$NamespaceManager.CreateQueue($QueueDescription);

I am looking for powershell cmdlets to create/ manage Shared Access Policy for a ServiceBus Queue.

Am able to add it from the management portal.

enter image description here

Also tried the below cmdlet,

New-AzureSBAuthorizationRule -Name "readwritepolicy" -Namespace "mynamespace"-Permission $("Send") -EntityName "notsure" -EntityType "Queue"

which gives me the below error,

New-AzureSBAuthorizationRule : Object reference not set to an instance of an object.
At line:1 char:1+ New-AzureSBAuthorizationRule -Name "readwritepolicy" -Namespace "mynamespace" ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : CloseError: (:) [New-AzureSBAuthorizationRule], NullReferenceException+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceBus.NewAzureSBAuthorizationRuleCommand

Am i doing anything wrong? What is EntityName ?


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>