< Back
New-AzureRmNotificationHubsNamespaceAuthorizationRules
Post
NAME New-AzureRmNotificationHubsNamespaceAuthorizationRules
SYNOPSIS
Creates an authorization rule and assigns that rule to a notification hub namespace.
SYNTAX
New-AzureRmNotificationHubsNamespaceAuthorizationRules [-ResourceGroup] <String> [-Namespace] <String> [-InputFile] <String> [-DefaultProfile
<IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
New-AzureRmNotificationHubsNamespaceAuthorizationRules [-ResourceGroup] <String> [-Namespace] <String> [-SASRule]
<SharedAccessAuthorizationRuleAttributes> [-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The New-AzureRmNotificationHubsNamespaceAuthorizationRules cmdlet creates a Shared Access Signature (SAS) authorization rule and assigns it to a
notification hub namespace. Authorization rules manage user rights to the namespace and to the notification hubs contained with that namespace.
This cmdlet provides two ways to create a new authorization rule and assign it to a namespace. You can create an instance of the
SharedAccessAuthorizationRuleAttributes object and then configure that object with the property values you want the new rule to possess. This can
be done using .NET Framework. You can then copy those property values to your new rule by using SASRule parameter.
Alternatively, you can create a JSON (JavaScript Object Notation) file containing the relevant configuration values and then apply those values by
using the InputFile parameter. A JSON file is a text file that uses syntax similar to the following:
{
"Name": "ContosoAuthorizationRule",
"PrimaryKey": "WE4qH0398AyXjlekt56gg1gMR3NHoMs29KkUnnpUk01Y=",
"Rights": [
"Listen",
"Send"
]
}
When used in conjunction with the New-AzureRmNotificationHubsNamespaceAuthorizationRules cmdlet, the preceding JSON sample creates an
authorization rule named ContosoAuthorizationRule that gives users Listen and Send rights to the namespace. The PrimaryKey that is used for
authentication, can be randomly generated by using the following Windows PowerShell command:
\\ Convert\\]::ToBase64String((1..32 |% { \\[byte/ (Get-Random -Minimum 0 -Maximum 255) }))
PARAMETERS
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-InputFile <String>
Specifies the path to a JSON file containing configuration information for the new authorization rule.
Required? true
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Namespace <String>
Specifies the namespace to which the authorization rules will be assigned.
Namespaces provide a way to group and categorize notification hubs. The new rules must be assigned to an existing namespace. The
New-AzureRmNotificationHubsNamespaceAuthorizationRules cmdlet cannot create a new namespace.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ResourceGroup <String>
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.
You must use an existing resource group. This cmdlet cannot create a new resource group.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-SASRule <SharedAccessAuthorizationRuleAttributes>
Specifies the SharedAccessAuthorizationRuleAttributes object containing configuration information for the new rules.
Required? true
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
This cmdlet does not accept any input.
OUTPUTS
Microsoft.Azure.Commands.NotificationHubs.Models.SharedAccessAuthorizationRuleAttributes
NOTES
Example 1: Create an authorization rule and assign it to a namespace
PS C:\\>New-AzureRmNotificationHubAuthorizationRules -Namespace "ContosoNamespace" -ResourceGroup "ContosoNotificationsGroup" -InputFile
"C:\\Configuration\\NamespaceAuthorizationRules.json"
This command creates an authorization rule and assigns that rule to the namespace ContosoNamespace. When creating this rule you must specify the
appropriate namespace and the resource group that the namespace is assigned to. However, you do not need to specify any information about the rule
itself: rule information will be taken from the input file C:\\Configuration\\NamespaceAuthorizationRules.json.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... ationrules
Get-AzureRmNotificationHubAuthorizationRules
Remove-AzureRmNotificationHubAuthorizationRules
Set-AzureRmNotificationHubAuthorizationRules
SYNOPSIS
Creates an authorization rule and assigns that rule to a notification hub namespace.
SYNTAX
New-AzureRmNotificationHubsNamespaceAuthorizationRules [-ResourceGroup] <String> [-Namespace] <String> [-InputFile] <String> [-DefaultProfile
<IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
New-AzureRmNotificationHubsNamespaceAuthorizationRules [-ResourceGroup] <String> [-Namespace] <String> [-SASRule]
<SharedAccessAuthorizationRuleAttributes> [-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The New-AzureRmNotificationHubsNamespaceAuthorizationRules cmdlet creates a Shared Access Signature (SAS) authorization rule and assigns it to a
notification hub namespace. Authorization rules manage user rights to the namespace and to the notification hubs contained with that namespace.
This cmdlet provides two ways to create a new authorization rule and assign it to a namespace. You can create an instance of the
SharedAccessAuthorizationRuleAttributes object and then configure that object with the property values you want the new rule to possess. This can
be done using .NET Framework. You can then copy those property values to your new rule by using SASRule parameter.
Alternatively, you can create a JSON (JavaScript Object Notation) file containing the relevant configuration values and then apply those values by
using the InputFile parameter. A JSON file is a text file that uses syntax similar to the following:
{
"Name": "ContosoAuthorizationRule",
"PrimaryKey": "WE4qH0398AyXjlekt56gg1gMR3NHoMs29KkUnnpUk01Y=",
"Rights": [
"Listen",
"Send"
]
}
When used in conjunction with the New-AzureRmNotificationHubsNamespaceAuthorizationRules cmdlet, the preceding JSON sample creates an
authorization rule named ContosoAuthorizationRule that gives users Listen and Send rights to the namespace. The PrimaryKey that is used for
authentication, can be randomly generated by using the following Windows PowerShell command:
\\ Convert\\]::ToBase64String((1..32 |% { \\[byte/ (Get-Random -Minimum 0 -Maximum 255) }))
PARAMETERS
-DefaultProfile <IAzureContextContainer>
The credentials, account, tenant, and subscription used for communication with azure
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-InputFile <String>
Specifies the path to a JSON file containing configuration information for the new authorization rule.
Required? true
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Namespace <String>
Specifies the namespace to which the authorization rules will be assigned.
Namespaces provide a way to group and categorize notification hubs. The new rules must be assigned to an existing namespace. The
New-AzureRmNotificationHubsNamespaceAuthorizationRules cmdlet cannot create a new namespace.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ResourceGroup <String>
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.
You must use an existing resource group. This cmdlet cannot create a new resource group.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-SASRule <SharedAccessAuthorizationRuleAttributes>
Specifies the SharedAccessAuthorizationRuleAttributes object containing configuration information for the new rules.
Required? true
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
This cmdlet does not accept any input.
OUTPUTS
Microsoft.Azure.Commands.NotificationHubs.Models.SharedAccessAuthorizationRuleAttributes
NOTES
Example 1: Create an authorization rule and assign it to a namespace
PS C:\\>New-AzureRmNotificationHubAuthorizationRules -Namespace "ContosoNamespace" -ResourceGroup "ContosoNotificationsGroup" -InputFile
"C:\\Configuration\\NamespaceAuthorizationRules.json"
This command creates an authorization rule and assigns that rule to the namespace ContosoNamespace. When creating this rule you must specify the
appropriate namespace and the resource group that the namespace is assigned to. However, you do not need to specify any information about the rule
itself: rule information will be taken from the input file C:\\Configuration\\NamespaceAuthorizationRules.json.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... ationrules
Get-AzureRmNotificationHubAuthorizationRules
Remove-AzureRmNotificationHubAuthorizationRules
Set-AzureRmNotificationHubAuthorizationRules