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 tsvBicep
// 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
Is your environment compliant with this rule?
CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.
Related Azure rules
- Action Group should be enabled
- Activity Log Alert should be enabled
- AKS cluster logs should be sent to Log Analytics
- AKS cluster must enable RBAC
- AKS cluster must enable RBAC
- AKS cluster should be a private cluster
- AKS cluster should disable local accounts
- AKS cluster should enable Azure RBAC for Kubernetes