|
| 1 | +--- |
| 2 | +title: Create an Azure notification hub using Bicep |
| 3 | +description: Learn how to create an Azure notification hub using Bicep. |
| 4 | +services: notification-hubs |
| 5 | +author: schaffererin |
| 6 | +ms.author: v-eschaffer |
| 7 | +ms.date: 05/24/2022 |
| 8 | +ms.topic: quickstart |
| 9 | +ms.service: notification-hubs |
| 10 | +ms.custom: devx-track-azurepowershell, subject-armqs, mode-arm |
| 11 | +--- |
| 12 | + |
| 13 | +# Quickstart: Create a notification hub using Bicep |
| 14 | + |
| 15 | +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). |
| 16 | + |
| 17 | +[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)] |
| 18 | + |
| 19 | +This quickstart uses Bicep to create an Azure Notification Hubs namespace, and a notification hub named **MyHub** within that namespace. |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +If you don't have an Azure subscription, create a [free](https://azure.microsoft.com/free/) account before you begin. |
| 24 | + |
| 25 | +## Review the Bicep file |
| 26 | + |
| 27 | +The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/notification-hub/). |
| 28 | + |
| 29 | +:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.notificationhubs/notification-hub/main.bicep"::: |
| 30 | + |
| 31 | +The Bicep file creates the two Azure resources: |
| 32 | + |
| 33 | +* [Microsoft.NotificationHubs/namespaces](/azure/templates/microsoft.notificationhubs/namespaces) |
| 34 | +* [Microsoft.NotificationHubs/namespaces/notificationHubs](/azure/templates/microsoft.notificationhubs/namespaces/notificationhubs) |
| 35 | + |
| 36 | +## Deploy the Bicep file |
| 37 | + |
| 38 | +1. Save the Bicep file as **main.bicep** to your local computer. |
| 39 | +1. Deploy the Bicep file using either Azure CLI or Azure PowerShell. |
| 40 | + |
| 41 | + # [CLI](#tab/CLI) |
| 42 | + |
| 43 | + ```azurecli |
| 44 | + az group create --name exampleRG --location eastus |
| 45 | + az deployment group create --resource-group exampleRG --template-file main.bicep --parameters namespaceName=<namespace-name> |
| 46 | + ``` |
| 47 | +
|
| 48 | + # [PowerShell](#tab/PowerShell) |
| 49 | +
|
| 50 | + ```azurepowershell |
| 51 | + New-AzResourceGroup -Name exampleRG -Location eastus |
| 52 | + New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -namespaceName "<namespace-name>" |
| 53 | + ``` |
| 54 | +
|
| 55 | + --- |
| 56 | +
|
| 57 | + >[!NOTE] |
| 58 | + > Replace **\<namespace-name\>** with the name of the Notifications Hub namespace. |
| 59 | +
|
| 60 | + When the deployment finishes, you should see a message indicating the deployment succeeded. |
| 61 | +
|
| 62 | +## Review deployed resources |
| 63 | +
|
| 64 | +Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group. |
| 65 | +
|
| 66 | +# [CLI](#tab/CLI) |
| 67 | +
|
| 68 | +```azurecli-interactive |
| 69 | +az resource list --resource-group exampleRG |
| 70 | +``` |
| 71 | + |
| 72 | +# [PowerShell](#tab/PowerShell) |
| 73 | + |
| 74 | +```azurepowershell-interactive |
| 75 | +Get-AzResource -ResourceGroupName exampleRG |
| 76 | +``` |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## Clean up resources |
| 81 | + |
| 82 | +When you no longer need the logic app, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources. |
| 83 | + |
| 84 | +# [CLI](#tab/CLI) |
| 85 | + |
| 86 | +```azurecli-interactive |
| 87 | +az group delete --name exampleRG |
| 88 | +``` |
| 89 | + |
| 90 | +# [PowerShell](#tab/PowerShell) |
| 91 | + |
| 92 | +```azurepowershell-interactive |
| 93 | +Remove-AzResourceGroup -Name exampleRG |
| 94 | +``` |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## Next steps |
| 99 | + |
| 100 | +For a step-by-step tutorial that guides you through the process of creating a Bicep file, see: |
| 101 | + |
| 102 | +> [!div class="nextstepaction"] |
| 103 | +> [Quickstart: Create Bicep files with Visual Studio Code](../azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code.md) |
0 commit comments