|
| 1 | +--- |
| 2 | +title: Azure Quickstart - Create a Batch account - Bicep file |
| 3 | +description: This quickstart shows how to create a Batch account by using a Bicep file. |
| 4 | +author: schaffererin |
| 5 | +ms.date: 03/22/2022 |
| 6 | +ms.topic: quickstart |
| 7 | +ms.author: v-eschaffer |
| 8 | +ms.custom: subject-armqs, mode-arm |
| 9 | +tags: azure-resource-manager, bicep |
| 10 | +--- |
| 11 | + |
| 12 | +# Quickstart: Create a Batch account by using a Bicep file |
| 13 | + |
| 14 | +Get started with Azure Batch by using a Bicep file to create a Batch account, including storage. You need a Batch account to create compute resources (pools of compute nodes) and Batch jobs. You can link an Azure Storage account with your Batch account, which is useful to deploy applications and store input and output data for most real-world workloads. |
| 15 | + |
| 16 | +After completing this quickstart, you'll understand the key concepts of the Batch service and be ready to try Batch with more realistic workloads at larger scale. |
| 17 | + |
| 18 | +[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)] |
| 19 | + |
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +You must have an active Azure subscription. |
| 23 | + |
| 24 | +- [!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)] |
| 25 | + |
| 26 | +## Review the Bicep file |
| 27 | + |
| 28 | +The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/batchaccount-with-storage/). |
| 29 | + |
| 30 | +:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.batch/batchaccount-with-storage/main.bicep"::: |
| 31 | + |
| 32 | +Two Azure resources are defined in the Bicep file: |
| 33 | + |
| 34 | +- [Microsoft.Storage/storageAccounts](/azure/templates/microsoft.storage/storageaccounts): Creates a storage account. |
| 35 | +- [Microsoft.Batch/batchAccounts](/azure/templates/microsoft.batch/batchaccounts): Creates a Batch account. |
| 36 | + |
| 37 | +## Deploy the Bicep file |
| 38 | + |
| 39 | +1. Save the Bicep file as **main.bicep** to your local computer. |
| 40 | +1. Deploy the Bicep file using either Azure CLI or Azure PowerShell. |
| 41 | + |
| 42 | + # [CLI](#tab/CLI) |
| 43 | + |
| 44 | + ```azurecli |
| 45 | + az group create --name exampleRG --location eastus |
| 46 | + az deployment group create --resource-group exampleRG --template-file main.bicep |
| 47 | + ``` |
| 48 | +
|
| 49 | + # [PowerShell](#tab/PowerShell) |
| 50 | +
|
| 51 | + ```azurepowershell |
| 52 | + New-AzResourceGroup -Name exampleRG -Location eastus |
| 53 | + New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep |
| 54 | + ``` |
| 55 | +
|
| 56 | + --- |
| 57 | +
|
| 58 | + When the deployment finishes, you should see a message indicating the deployment succeeded. |
| 59 | +
|
| 60 | +## Validate the deployment |
| 61 | +
|
| 62 | +Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group. |
| 63 | +
|
| 64 | +# [CLI](#tab/CLI) |
| 65 | +
|
| 66 | +```azurecli-interactive |
| 67 | +az resource list --resource-group exampleRG |
| 68 | +``` |
| 69 | + |
| 70 | +# [PowerShell](#tab/PowerShell) |
| 71 | + |
| 72 | +```azurepowershell-interactive |
| 73 | +Get-AzResource -ResourceGroupName exampleRG |
| 74 | +``` |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Clean up resources |
| 79 | + |
| 80 | +If you plan to continue on with more of our [tutorials](./tutorial-parallel-dotnet.md), you may want to leave these resources in place. When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and all of its resources. |
| 81 | + |
| 82 | +# [CLI](#tab/CLI) |
| 83 | + |
| 84 | +```azurecli-interactive |
| 85 | +az group delete --name exampleRG |
| 86 | +``` |
| 87 | + |
| 88 | +# [PowerShell](#tab/PowerShell) |
| 89 | + |
| 90 | +```azurepowershell-interactive |
| 91 | +Remove-AzResourceGroup -Name exampleRG |
| 92 | +``` |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Next steps |
| 97 | + |
| 98 | +In this quickstart, you created a Batch account and a storage account using Bicep. To learn more about Azure Batch, continue to the Azure Batch tutorials. |
| 99 | + |
| 100 | +> [!div class="nextstepaction"] |
| 101 | +> [Azure Batch tutorials](./tutorial-parallel-dotnet.md) |
0 commit comments