You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/notification-hubs/create-notification-hub-azure-cli.md
+62-64Lines changed: 62 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,101 +30,99 @@ Notification Hubs requires version 2.0.67 or later of the Azure CLI. Run `az --v
30
30
31
31
## Prepare your environment
32
32
33
-
###Sign in
33
+
1. Sign in using the [az login](/cli/azure/reference-index#az-login) command if you're using a local install of the CLI.
34
34
35
-
Sign in using the [az login](/cli/azure/reference-index#az-login) command if you're using a local install of the CLI.
35
+
```azurecli-interactive
36
+
az login
37
+
```
36
38
37
-
```azurecli-interactive
38
-
az login
39
-
```
39
+
Follow the steps displayed in your terminal to complete the authentication process.
40
40
41
-
Follow the steps displayed in your terminal to complete the authentication process.
41
+
2. To run the Azure CLI commands for notification hubs, install the Azure CLI [extension for Notification Hubs](/cli/azure/ext/notification-hub/notification-hub).
42
42
43
-
### Install notification hubs extension
43
+
```azurecli-interactive
44
+
az extension add --name notification-hub
45
+
```
44
46
45
-
To run the Azure CLI commands for notification hubs, install the Azure CLI [extension for Notification Hubs](/cli/azure/ext/notification-hub/notification-hub).
47
+
3.Azure notification hubs, like all Azure resources, must be deployed into a resource group. Resource groups allow you to organize and manage related Azure resources.
46
48
47
-
```azurecli-interactive
48
-
az extension add --name notification-hub
49
-
```
49
+
For this quickstart, create a resource group named *spnhubrg* in the *eastus* location with the following [az group create](/cli/azure/group#az-group-create) command:
50
50
51
-
### Create a resource group
51
+
```azurecli-interactive
52
+
az group create --name spnhubrg --location eastus
53
+
```
52
54
53
-
Azure notification hubs, like all Azure resources, must be deployed into a resource group. Resource groups allow you to organize and manage related Azure resources.
55
+
## Create a namespace
54
56
55
-
For this quickstart, create a resource group named *spnhubrg* in the *eastus* location with the following [az group create](/cli/azure/group#az-group-create) command:
57
+
1. Create a notification hub namespace.
58
+
59
+
A namespace contains one or more hubs, and the name must be unique across all Azure subscriptions. To check the availability of the given service namespace, use the [az notification-hub namespace check-availability](/cli/azure/ext/notification-hub/notification-hub/namespace#ext-notification-hub-az-notification-hub-namespace-check-availability) command. Run the [az notification-hub namespace create](/cli/azure/ext/notification-hub/notification-hub/namespace#ext-notification-hub-az-notification-hub-namespace-create) command to create a namespace.
56
60
57
-
```azurecli-interactive
58
-
az group create --name spnhubrg --location eastus
59
-
```
61
+
```azurecli-interactive
62
+
#check availability
63
+
az notification-hub namespace check-availability --name spnhubns
2. List keys and connection strings for a namespace access policy
62
70
63
-
A namespace contains one or more hubs, and the name must be unique across all Azure subscriptions. To check the availability of the given service namespace, use the [az notification-hub namespace check-availability](/cli/azure/ext/notification-hub/notification-hub/namespace#ext-notification-hub-az-notification-hub-namespace-check-availability) command. Run the [az notification-hub namespace create](/cli/azure/ext/notification-hub/notification-hub/namespace#ext-notification-hub-az-notification-hub-namespace-create) command to create a namespace.
71
+
An access policy is automatically created for a new namespace. There are two sets of keys and connection strings for each access policy. To list the keys and connection strings for the namespace, run the [az notification-hub namespace authorization-rule list-keys](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list-keys) command.
64
72
65
-
```azurecli-interactive
66
-
#check availability
67
-
az notification-hub namespace check-availability --name spnhubns
### List keys and connection strings for a namespace access policy
74
-
75
-
An access policy is automatically created for a new namespace. There are two sets of keys and connection strings for each access policy. To list the keys and connection strings for the namespace, run the [az notification-hub namespace authorization-rule list-keys](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list-keys) command.
A notification hub can now be created in the new namespace. Run the [az notification-hub create](/cli/azure/ext/notification-hub/notification-hub#ext-notification-hub-az-notification-hub-create) command to create a notification hub.
79
+
1.A notification hub can now be created in the new namespace. Run the [az notification-hub create](/cli/azure/ext/notification-hub/notification-hub#ext-notification-hub-az-notification-hub-create) command to create a notification hub.
Multiple notification hubs can be created in a single namespace. To create a second notification hub in the same namespace, run the `az notification-hub create` command again using a different hub name.
85
+
Multiple notification hubs can be created in a single namespace. To create a second notification hub in the same namespace, run the `az notification-hub create` command again using a different hub name.
### Create a new authorization-rule for a notification hub
91
+
##Work with access policies
96
92
97
-
An access policy is automatically created for each new notification hub. To create and customize your own access policy, use the [az notification-hub authorization-rule create](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-create) command.
93
+
1. Create a new authorization-rule for a notification hub
An access policy is automatically created for each new notification hub. To create and customize your own access policy, use the [az notification-hub authorization-rule create](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-create) command.
To query what access policies exist for a notification hub, use the [az notification-hub authorization-rule list](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list) command.
101
+
2. List access policies for a notification hub
106
102
107
-
```azurecli-interactive
108
-
az notification-hub authorization-rule list --resource-group spnhubrg --namespace-name spnhubns --notification-hub-name spfcmtutorial1nhub --output table
109
-
```
103
+
To query what access policies exist for a notification hub, use the [az notification-hub authorization-rule list](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list) command.
110
104
111
-
> [!IMPORTANT]
112
-
> Do not use the **DefaultFullSharedAccessSignature** policy in your application. This is meant to be used in your app backend only.
105
+
```azurecli-interactive
106
+
az notification-hub authorization-rule list --resource-group spnhubrg --namespace-name spnhubns --notification-hub-name spfcmtutorial1nhub --output table
107
+
```
113
108
114
-
### List keys and connection strings for a notification hub access policy
109
+
> [!IMPORTANT]
110
+
> Do not use the **DefaultFullSharedAccessSignature** policy in your application. This is meant to be used in your app backend only.
115
111
116
-
There are two sets of keys and connection strings for each access policy. You'll need them later to handle push notifications. To list the keys and connections strings for a notification hub access policy, use the [az notification-hub authorization-rule list-keys](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list-keys) command.
112
+
3. List keys and connection strings for a notification hub access policy
117
113
118
-
```azurecli-interactive
119
-
#query the keys and connection strings for DefaultListenSharedAccessSignature
There are two sets of keys and connection strings for each access policy. You'll need them later to handle push notifications. To list the keys and connections strings for a notification hub access policy, use the [az notification-hub authorization-rule list-keys](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list-keys) command.
121
115
122
-
#query the keys and connection strings for the custom policy
> A [notification hub namespace](/cli/azure/ext/notification-hub/notification-hub/namespace/authorization-rule#ext-notification-hub-az-notification-hub-namespace-authorization-rule-list-keys) and a [notification hub](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list-keys) have separate access policies. Make sure you are using the correct Azure CLI reference when querying for keys and connection strings.
124
+
> [!NOTE]
125
+
> A [notification hub namespace](/cli/azure/ext/notification-hub/notification-hub/namespace/authorization-rule#ext-notification-hub-az-notification-hub-namespace-authorization-rule-list-keys) and a [notification hub](/cli/azure/ext/notification-hub/notification-hub/authorization-rule#ext-notification-hub-az-notification-hub-authorization-rule-list-keys) have separate access policies. Make sure you are using the correct Azure CLI reference when querying for keys and connection strings.
0 commit comments