Batch account should use User Subscription pool allocation mode

Medium Azure General batchaccounts-batch-account-user-subscription

Applies to

  • Microsoft.Batch/batchAccounts

What CGPulse checks

A resource passes this rule when poolAllocationMode must equal UserSubscription. Anything else is reported as a finding with the evaluated property value attached as evidence.

How to fix it

Set pool allocation mode to User Subscription for better control over compute resources. In Azure Portal: Batch account > Properties > verify pool allocation mode. See: https://learn.microsoft.com/en-us/azure/batch/best-practices#pool-configuration-and-naming

CLI

az batch account show --ids "{id}" --query "poolAllocationMode" -o tsv

Bicep

// Pool allocation mode cannot be changed after creation

resource batch 'Microsoft.Batch/batchAccounts@2024-02-01' = {{
  name: '{name}'
  location: resourceGroup().location
  properties: {{
    poolAllocationMode: 'UserSubscription'
  }}
}}

Terraform

# Pool allocation mode is set at account creation and cannot be changed
resource "azurerm_batch_account" "{name}" {
  name                                = "{name}"
  resource_group_name                 = "{rg}"
  location                            = var.location
  pool_allocation_mode                = "UserSubscription"
  storage_account_id                  = "<storage-account-id>"
  storage_account_authentication_mode = "StorageKeys"
}

Compliance frameworks

Vendor documentation

Is your environment compliant with this rule?

CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.

Run a free scan

Related Azure rules

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.