Azure / Azure/Batch

Can't create pool from az batch cli using json file

Open
#162 2 comments 0 reactions 1 assignee Claimed by @dpwatrous View on GitHub
under investigation
Dominant language
No language data
Stars
27
Forks
29
PR merge metrics
No merged PRs in 30d

Description

#### Problem Description
I am trying to create a pool that is configured with a JSON file. It works fine if I upload the JSON file in the create pool GUI interface except that I have to type to pool id by hand. However if I use the same file with Azure CLI I get an error saying I need to provide an id. My file matches the format described [here](https://learn.microsoft.com/en-us/rest/api/batchservice/pool/add?tabs=HTTP#add-a-pool-with-accelerated-networking)

Also the documentation [here](https://learn.microsoft.com/en-us/azure/batch/batch-cli-get-started#create-resources-with-json) says that you should call `az batch pool .json` to use a JSON file to configure a new Batch pool resource but that is incorrect and gives a "not recognized" error.

#### Steps to Reproduce

```
az login
az batch account login -g -n
az batch pool create --json-file template_add_pool.json
```
Json file
```JSON
{
"properties": {
"id": "poolId",
"vmSize": "standard_A1_v2",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "microsoft-azure-batch",
"offer": "ubuntu-server-container",
"sku": "20-04-lts",
"version": "latest"
},
"nodeAgentSKUId": "batch.node.ubuntu 20.04",
"containerConfiguration": {
"type": "dockerCompatible",
"containerImageNames": [
"rocker/r-bspm:jammy"
]
},
"nodePlacementConfiguration": {
"policy": "regional"
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1
}
},
"networkConfiguration": {
"subnetId":
}
}
}
```
#### Expected Results
A pool is created

#### Actual Results
ERROR: Parameter 'PoolAddParameter.id' can not be None.

If I try to supply the id outside the Json with `--id "cli_id_test"` I get:
```
ERROR: --json-file cannot be combined with:
--id
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.