Edit

Share via


New-AzNotificationHubAuthorizationRule

Creates an authorization rule and assigns the rule to a notification hub.

Syntax

InputFileParameterSet

New-AzNotificationHubAuthorizationRule
    [-ResourceGroup] <String>
    [-Namespace] <String>
    [-NotificationHub] <String>
    [-InputFile] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SASRuleParameterSet

New-AzNotificationHubAuthorizationRule
    [-ResourceGroup] <String>
    [-Namespace] <String>
    [-NotificationHub] <String>
    [-SASRule] <SharedAccessAuthorizationRuleAttributes>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-AzNotificationHubAuthorizationRule cmdlet creates a notification hub Shared Access Signature (SAS) authorization rule. Authorization rules are used to manage access to your notification hubs. This is done by the creation of links, as URIs, based on different permission levels. Clients are directed to one of these URIs based on the appropriate permission level. For example, a client given the Listen permission will be directed to the URI for that permission.

Examples

Example 1: Create a notification hub authorization rule

New-AzNotificationHubAuthorizationRule -Namespace "ContosoNamespace" -NotificationHub "ContosoInternalHub" -ResourceGroup "ContosoNotificationsGroup" -InputFile "C:\Configuration\ExternalAccessRule.json"

This command creates a new authorization rule and assigns it to the notification hub named ContosoInternalHub. This hub is located in the ContosoNamespace namespace and is assigned to the ContosoNotificationsGroup resource group. Note that all the configuration information for the rule, including the rule name, will be taken from the input file C:\Configuration\ExternalAccessRule.json.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputFile

Specifies the input file for the authorization rule that this cmdlet creates.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputFileParameterSet
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Namespace

Specifies the namespace to which the authorization rules are assigned. Namespaces provide a way to group and categorize notification hubs.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-NotificationHub

Specifies the notification hub that the authorization rules will be assigned to. Notification hubs are used to send push notifications to multiple clients regardless of the platform used by those clients. Note that you must specify the name of an existing notification hub. The New-AzNotificationHubAuthorizationRule cmdlet cannot create new notification hubs.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroup

Specifies the resource group that the notification hub is assigned to.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SASRule

Specifies the SharedAccessAuthorizationRuleAttributes object containing configuration information for the new rules.

Parameter properties

Type:SharedAccessAuthorizationRuleAttributes
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SASRuleParameterSet
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Outputs

SharedAccessAuthorizationRuleAttributes