Azure Batch Account
This page shows how to write Terraform and Azure Resource Manager for Batch Account and write them securely.
azurerm_batch_account (Terraform)
The Account in Batch can be configured in Terraform with the resource name azurerm_batch_account
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_batch_account" "example" {
name = "jhbatchtest"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
pool_allocation_mode = "BatchService"
storage_account_id = azurerm_storage_account.strg.id
resource "azurerm_batch_account" "this" {
location = var.location
name = var.name
pool_allocation_mode = var.pool_allocation_mode
resource_group_name = var.resource_group_name
storage_account_id = var.storage_account_id
resource "azurerm_batch_account" "this" {
location = var.location
name = var.name
pool_allocation_mode = var.pool_allocation_mode
resource_group_name = var.resource_group_name
storage_account_id = var.storage_account_id
resource "azurerm_batch_account" "MDSBatchACCT" {
name = "mdsbatchaccount"
resource_group_name = azurerm_resource_group.MDSDATAFAC.name
location = azurerm_resource_group.MDSDATAFAC.location
pool_allocation_mode = "BatchService"
storage_account_id = azurerm_storage_account.MDSBatch.id
Parameters
-
account_endpoint
optional computed - string -
id
optional computed - string -
location
required - string -
name
required - string -
pool_allocation_mode
optional - string -
primary_access_key
optional computed - string -
resource_group_name
required - string -
secondary_access_key
optional computed - string -
storage_account_id
optional computed - string -
tags
optional - map from string to string -
key_vault_reference
list block -
timeouts
single block
Explanation in Terraform Registry
Manages an Azure Batch account.
Microsoft.Batch/batchAccounts (Azure Resource Manager)
The batchAccounts in Microsoft.Batch can be configured in Azure Resource Manager with the resource name Microsoft.Batch/batchAccounts
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2015-12-07",
"properties": {}
}
},
{
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2015-12-07",
"name": "name",
"location": "westus",
"properties": {}
}
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2021-01-01",
"name": "[parameters('batchAccounts_batches_name')]",
"location": "[parameters('location')]",
"identity": {
"type": "None"
"propertyValue" : "Microsoft.Batch/batchAccounts",
"query" : "resource_type:\"Microsoft.Batch/batchAccounts\"",
"type" : "property",
"value" : "Microsoft.Batch/batchAccounts"
}, {
"NOT" : false,
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2021-06-01",
"name": "[parameters('batchAccounts_abc0682d9_name')]",
"location": "[parameters('location')]",
"identity": {
"type": "None"
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2021-06-01",
"name": "[parameters('batchAccounts_abc0682d9_name')]",
"location": "[parameters('location')]",
"identity": {
"type": "None"
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2021-06-01",
"name": "[parameters('batchAccounts_abc0682d9_name')]",
"location": "[parameters('location')]",
"identity": {
"type": "None"
"type": "Microsoft.Batch/batchAccounts",
"name": "[parameters('batchAccountName')]",
"apiVersion": "2017-09-01",
"dependsOn": [
"[variables('batchStorageId')]"
],
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2021-06-01",
"name": "[parameters('batchAccounts_abc0682d9_name')]",
"location": "[parameters('location')]",
"identity": {
"type": "None"
"type": "Microsoft.Batch/batchAccounts",
"apiVersion": "2021-06-01",
"name": "[parameters('batchAccounts_abc0682d9_name')]",
"location": "[parameters('location')]",
"identity": {
"type": "None"
Parameters
apiVersion
required - stringidentity
optionaltype
required - stringThe type of identity used for the Batch account.
userAssignedIdentities
optional - undefinedThe list of user identities associated with the Batch account.
location
required - stringThe region in which to create the account.
name
required - stringA name for the Batch account which must be unique within the region. Batch account names must be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used as part of the DNS name that is used to access the Batch service in the region in which the account is created. For example: http://accountname.region.batch.azure.com/.
properties
requiredallowedAuthenticationModes
optional - arrayList of allowed authentication modes for the Batch account that can be used to authenticate with the data plane. This does not affect authentication with the control plane.
autoStorage
optionalauthenticationMode
optional - stringThe authentication mode which the Batch service will use to manage the auto-storage account.
nodeIdentityReference
optionalresourceId
optional - stringThe ARM resource id of the user assigned identity.
storageAccountId
required - stringThe resource ID of the storage account to be used for auto-storage account.
encryption
optionalkeySource
optional - stringType of the key source.
keyVaultProperties
optionalkeyIdentifier
optional - stringFull path to the versioned secret. Example https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following prerequisites must be met: The Batch Account has a System Assigned identity The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap permissions The KeyVault has soft-delete and purge protection enabled
keyVaultReference
optionalid
required - stringThe resource ID of the Azure key vault associated with the Batch account.
url
required - stringThe URL of the Azure key vault associated with the Batch account.
poolAllocationMode
optional - stringThe pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService.
publicNetworkAccess
optional - stringIf not specified, the default value is 'enabled'.
tags
optional - stringThe user-specified tags associated with the account.
type
required - string
Frequently asked questions
What is Azure Batch Account?
Azure Batch Account is a resource for Batch of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Batch Account?
For Terraform, the learncloud/Azure, kevinhead/azurerm and niveklabs/azurerm source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the chironconsulting/ARM-Schema-Templates, Azure/autorest.azureresourceschema and PrandoXMR/cryptocloud source code examples are useful. See the Azure Resource Manager Example section for further details.