1

I'm looking for any examples of configuring Azure Batch using an Azure Resource Manager template. Googling yielded nothing, and the Azure QuickStart Templates do not yet have any Batch examples, however this SO question implies that it has been done.

What I would like to achieve is, via an ARM template, to create a Batch account and configure a pool (with a minimum number of compute nodes, auto expanding to a maximum number of nodes), and then set the resulting pool ID into my API server's appsettings resource.

I'm about to start reverse engineering it using the Azure Resource Explorer, but any pre-existing examples would be very much appreciated.

Update

So far I've managed to create the resource:

{
  "name": "[variables('batchAccountName')]",
  "type": "Microsoft.Batch/batchAccounts",
  "location": "[resourceGroup().location]",
  "apiVersion": "2015-07-01",
  "dependsOn": [ ],
  "tags": {
    "displayName": "BatchInstance"
  }
}

And to configure the account settings in the appsettings of my API server:

"BATCH_ACCOUNT_URL": "[concat('https://', reference(concat('Microsoft.Batch/batchAccounts/', variables('batchAccountName'))).accountEndpoint)]",
"BATCH_ACCOUNT_KEY": "[listKeys(resourceId('Microsoft.Batch/batchAccounts', variables('batchAccountName')), providers('Microsoft.Batch', 'batchAccounts').apiVersions[0]).primary]",
"BATCH_ACCOUNT_NAME": "[variables('batchAccountName')]"

I still haven't managed to create a pool and fetch the pool ID via ARM, mainly because the pool I created using Batch Explorer never showed up in either the Azure Portal or the Azure Resource Explorer. I'll update this if I find the solution.

Community
  • 1
  • 1
James Thurley
  • 2,650
  • 26
  • 38

2 Answers2

1

Unfortunately we don't have a way today to create a pool using ARM templates. The Azure Portal should show the pools created under your account (even if you didn't created them using ARM).

NarG
  • 26
  • 1
  • Thanks NarG, the second Batch account I created (via ARM) reflected the pools fine so not sure what the issue was with the first one. Thanks for the answer, I've gone for programmatically creating the pools in the end. – James Thurley Mar 02 '16 at 07:54
1

This is supported, please see the reference docs here: https://learn.microsoft.com/azure/templates/microsoft.batch/2019-04-01/batchaccounts/pools

fpark
  • 2,304
  • 2
  • 14
  • 21