|
| 1 | +--- |
| 2 | +title: Create an Azure notification hub using Azure Resource Manager template |
| 3 | +description: Learn how to create an Azure notification hub by using an Azure Resource Manager template. |
| 4 | +services: notification-hubs |
| 5 | +author: sethmanheim |
| 6 | + |
| 7 | +ms.service: notification-hubs |
| 8 | +ms.topic: quickstart |
| 9 | +ms.custom: subject-armqs |
| 10 | +ms.author: sethm |
| 11 | +ms.date: 05/15/2020 |
| 12 | +ms.reviewer: thsomasu |
| 13 | +ms.lastreviewed: 05/15/2020 |
| 14 | +--- |
| 15 | + |
| 16 | +# Quickstart: create a notification hub using an Azure Resource Manager template |
| 17 | + |
| 18 | +Azure Notification Hubs provides an easy-to-use and scaled-out push engine that enables you to send notifications to any platform (iOS, Android, Windows, Kindle, etc.) from any backend (cloud or on-premises). For more information about the service, see [What is Azure Notification Hubs](notification-hubs-push-notification-overview.md). |
| 19 | + |
| 20 | +This quickstart uses an Azure Resource Manager template to create an Azure Notification Hubs namespace, and a notification hub named "MyHub" within that namespace. |
| 21 | + |
| 22 | +[!INCLUDE [About Azure Resource Manager](../../includes/resource-manager-quickstart-introduction.md)] |
| 23 | + |
| 24 | +If you don't have an Azure subscription, create a [free](https://azure.microsoft.com/free/) account before you begin. |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +None. |
| 29 | + |
| 30 | +## Create a Notification Hubs namespace and hub |
| 31 | + |
| 32 | +<!-- The second H2 must start with "Create a". For example, 'Create a Key Vault', 'Create a virtual machine', etc. --> |
| 33 | + |
| 34 | +### Review the template |
| 35 | + |
| 36 | +The template used in this quickstart is from [Azure Quickstart templates](https://azure.microsoft.com/resources/templates/101-notification-hub/). |
| 37 | + |
| 38 | +:::code language="json" source="~/quickstart-templates/101-notification-hub/azuredeploy.json" range="1-45" highlight="22-40"::: |
| 39 | + |
| 40 | +* [Microsoft.NotificationHubs/namespaces](/azure/templates/microsoft.notificationhubs/2017-04-01/namespaces) |
| 41 | +* [Microsoft.NotificationHubs/namespaces/notificationHubs](/azure/templates/microsoft.notificationhubs/2017-04-01/namespaces/notificationhubs) |
| 42 | + |
| 43 | +## Deploy the template |
| 44 | + |
| 45 | +Select the following image to sign in to Azure and open a template. The template takes a Notification Hubs namespace name as a parameter. The template then creates a namespace with that name and a notification hub named **MyHub** within that namespace. |
| 46 | + |
| 47 | +[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-notification-hub%2Fazuredeploy.json) |
| 48 | + |
| 49 | +## Review deployed resources |
| 50 | + |
| 51 | +You can either use the Azure portal to check the deployed resources, or use Azure CLI or Azure PowerShell script to list the deployed Notification Hubs namespace and hub: |
| 52 | + |
| 53 | +# [PowerShell](#tab/PowerShell) |
| 54 | + |
| 55 | +```azurepowershell-interactive |
| 56 | +Get-AzNotificationHub -Namespace "nhtestns123" -ResourceGroup "ContosoNotificationsGroup" |
| 57 | +Get-AzNotificationHubsNamespace -Namespace "nhtestns123" |
| 58 | +``` |
| 59 | + |
| 60 | +# [CLI](#tab/CLI) |
| 61 | + |
| 62 | +```azurecli-interactive |
| 63 | +az notification-hub show --resource-group ContosoNotificationsGroup --namespace-name nhtestns123 --name MyHub |
| 64 | +az notification-hub namespace show --resource-group ContosoNotificationsGroup --name nhtestns123 |
| 65 | +``` |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +The output looks similar to: |
| 70 | + |
| 71 | +:::image type="content" source="media/create-notification-hub-template/verify-deploy.png" alt-text="Verify deployment"::: |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## Clean up resources |
| 76 | + |
| 77 | +When no longer needed, delete the resource group, which deletes the resources in the resource group. |
| 78 | + |
| 79 | +```azurepowershell-interactive |
| 80 | +$resourceGroupName = Read-Host -Prompt "Enter the resource group name" |
| 81 | +Remove-AzResourceGroup -Name $resourceGroupName |
| 82 | +Write-Host "Press [ENTER] to continue..." |
| 83 | +``` |
| 84 | + |
| 85 | +## Next steps |
| 86 | + |
| 87 | +For a step-by-step tutorial that guides you through the process of creating a template, see: |
| 88 | + |
| 89 | +> [!div class="nextstepaction"] |
| 90 | +> [Tutorial: Create and deploy your first Azure Resource Manager template](/azure/azure-resource-manager/templates/template-tutorial-create-first-template.md) |
0 commit comments