Creating Pool from JSON in Azure Batch GUI: Could not find member 'vmSize' on object of type 'Pool'.

Sarah 0 Reputation points
2023-02-27T21:32:40.1866667+00:00

I am trying use a JSON file to create a pool in the Azure Batch Graphical User Interface. I click Add (JSON editor) and then upload the JSON below. I get this error message: "InvalidRequestBody: The specified Request Body is not syntactically valid. RequestId:d588e0b0-6458-4c05-bb1d-7983bc57c7d4 Time:2023-02-27T21:11:51.9016289Z

Reason: Could not find member 'vmSize' on object of type 'Pool'. Path 'vmSize', line 1, position 32.
PropertyPath: vmSize"

{
  "id": "Sarah_testPool",
  "vmSize": "Standard_A1_v2",
  "virtualMachineConfiguration": {
    "imageReference": {
      "publisher": "azure-microsoft-batch",
      "offer": "ubuntu-server-container",
      "sku": "20-04-lts",
	  "version": "latest",
	  "virtualMachineImageId": "n/a"
    },
    "nodeAgentSKUId": "batch.node.ubuntu 20.04",
    "containerConfiguration": {
      "type": "dockerCompatible",
      "containerImageNames": [
        "rocker/r-bspm:jammy"
      ],
	  "containerRegistries": [{
	    "registryServer": "docker.io"
	  }]
    },
	"nodePlacementConfiguration": {
	  "policy": "regional"
	}
  },
  "resizeTimeout": "PT15M",
  "targetDedicatedNodes": 1,
  "targetLowPriorityNodes": 0,
  "taskSlotsPerNode": 1,
  "taskSchedulingPolicy": {
    "nodeFillType": "pack"
  },
  "enableAutoScale": false,
  "networkConfiguration": {
    "subnetId":"<redacted>"
  }
}

I have tried a few things like changing the capitalization or removing Standard and just having the size sku but it was the same. Can you tell me what I am doing wrong?

Also, I would like to flag that the example code that shows up when you open the JSON editor is flagged by the editor as missing many parameters. In addition, clicking the link Open reference takes you to this page: https://video2.skills-academy.com/en-us/rest/api/batchmanagement/pool/create?WT.mc_id=Portal-Microsoft_Azure_Batch&tabs=HTTP which has a similar format to the example code but does not seem to work. I had more success following the format here https://video2.skills-academy.com/en-us/rest/api/batchservice/pool/add?tabs=HTTP#virtualmachineconfiguration. Finally, The JSON editor window will not scroll down to see all the code in the window when a long file is uploaded

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
320 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sarah 0 Reputation points
    2023-02-27T22:16:12.4633333+00:00

    I was actually able to get this to work eventually using the syntax that is in the template and the linked reference but the JSON editor continued to highlight an error which is why I thought initially that I needed to use a different syntax.

    User's image

    Also the two different formats make it difficult to use an existing pool created by using the GUI and then exporting the JSON from the Properties tab as a template. Because that JSON file is in the format used by the Pool add link above rather than the pool create one.