New-SBAuthorizationRule

New-SBAuthorizationRule

This cmdlet creates a new Shared Access Secret (SAS) authorization rule for a Service Bus service namespace.

Syntax

Parameter Set: Default
New-SBAuthorizationRule -Name <String> -NamespaceName <String> [-PrimaryKey <String> ] [-Rights <AccessRight[]> ] [-SecondaryKey <String> ] [ <CommonParameters>]

Detailed Description

Run New-SBAuthorizationRule to create a new Shared Access Secret (SAS) authorization rule to your Service Bus service namespace. A SAS authorization rule enables clients to manage and exchange messages with messaging entities defined within the scope of the namespace. Use SAS authorization rules when you cannot use domain joined users as your tenant. A SAS authorization rule has a scope (the Service Bus service namespace), a set of rights (manage, send, or receive), and a pair of keys (primary and secondary) that clients can use.

Parameters

-Name<String>

The name of the newly-created authorization rule.

Aliases

n

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-NamespaceName<String>

The scope of the newly-created authorization rule.

Aliases

ns

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-PrimaryKey<String>

The key that will be used by this authorization rule. If not provided, Service Bus generates a key. You can explicitly set this parameter if you want to reinstall a farm while keeping the client untouched.

Aliases

primary

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Rights<AccessRight[]>

The comma separated list of access rights enabled with this authorization rule. Access rights include manage, send and listen.

Aliases

rs

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-SecondaryKey<String>

The key which will be used by this authorization rule. If not provided, Service Bus generates a key. You can explicitly set this parameter if you want to reinstall a farm while keeping the client untouched.

Aliases

secondary

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1

The following example creates a new rule for myNamespace called myRule. The newly-created rule grants send and listen access rights for clients that use the key. Note that in this example, the key is automatically generated, and a call to Get-SBAuthorizationRule is required.

PS C:\> New-SBAuthorizationRule -NamespaceName mynamespace -name myRule -Rights send,listen

Example 2

The following example creates a new rule for myNamespace called myRule2. The newly-created rule uses a predefined primary (a 32 bytes ASCII string).

PS C:\> $myKey = '!@123456789012345678901234567890'PS C:\>$base64Key = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($myKey))PS C:\>New-SBAuthorizationRule -NamespaceName myNamespace -name myrule2 -PrimaryKey $base64Key

Service Bus 1.0 MSDN Community Forum