Edit

Share via


Set-AzNotificationHubsNamespaceAuthorizationRule

Sets authorization rules for a notification hub namespace.

Syntax

InputFileParameterSet

Set-AzNotificationHubsNamespaceAuthorizationRule
    [-ResourceGroup] <String>
    [-Namespace] <String>
    [-InputFile] <String>
    [-Force]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

SASRuleParameterSet

Set-AzNotificationHubsNamespaceAuthorizationRule
    [-ResourceGroup] <String>
    [-Namespace] <String>
    [-SASRule] <SharedAccessAuthorizationRuleAttributes>
    [-Force]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-AzNotificationHubsNamespaceAuthorizationRule cmdlet modifies a Shared Access Signature (SAS) authorization rule assigned to a notification hub namespace. Authorization rules manage user rights to the namespace and to the notification hubs contained in that namespace. This cmdlet provides two ways to modify an authorization rule assigned to a namespace. For one, you can create an instance of the SharedAccessAuthorizationRuleAttributes object and then configure that object with the property values you want the rule to possess. You can use the .NET Framework to accomplish this. You can then copy those property values to the rule through the SASRule parameter. Alternatively, you can create a JSON (JavaScript Object Notation) file containing the relevant configuration values and then apply those values through the InputFile parameter. A JSON file is a text file that uses syntax similar to this: { "Name": "ContosoAuthorizationRule", "PrimaryKey": "W******1Y=", "Rights": [ "Listen", "Send" ] } When used in conjunction with the Set-AzNotificationHubsNamespaceAuthorizationRule cmdlet, the preceding JSON sample modifies an authorization rule named ContosoAuthorizationRule to give users Listen and Send rights to the namespace.

Examples

Example 1: Modify an authorization rule assigned to a namespace

Set-AzNotificationHubsNamespaceAuthorizationRule -Namespace "ContosoNamespace" -ResourceGroup "ContosoNotificationGroup" -InputFile "C:\Configuration\AuthorizationRules.json"

This command modifies an authorization rule assigned to the namespace named ContosoNamespace. You must specify the resource group that the namespace is assigned to. Information about the authorization rule is not included in the command itself. Instead, that information is obtained from the input file C:\Configuration\AuthorizationRules.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

-Force

Do not ask for confirmation.

Parameter properties

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

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 path to a JSON file containing configuration information for the new rule.

Parameter properties

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

Parameter sets

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

-Namespace

Specifies the namespace that contains the authorization rules that this cmdlet modifies. 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

-ResourceGroup

Specifies the resource group to which the namespace is assigned. Resource groups organize items such as namespaces, notification hubs, and authorization rules in ways that help simply inventory management and Azure administration.

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 that contains configuration information for the authorization rules that this cmdlet modifies.

Parameter properties

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

Parameter sets

SASRuleParameterSet
Position:2
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