Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
see24 opened this issue Sep 22, 2023 · 1 comment
Open

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

see24 opened this issue Sep 22, 2023 · 1 comment
Assignees
Labels
under investigation Under investigation by team

Comments

@see24
Copy link

see24 commented Sep 22, 2023

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

Also the documentation here says that you should call az batch pool <your-batch-pool-configuration>.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 <group> -n <name>
az batch pool create --json-file template_add_pool.json

Json file

{
    "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": <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
@see24
Copy link
Author

see24 commented Sep 22, 2023

I was able to get it to work in the end by trail and error of changing much of the JSON syntax. The Json that worked was the following:

{
	"type": "Microsoft.Batch/batchAccounts/pools",
	"apiVersion": "2016-12-01",
	"id": "test_pool_json_cli",
	"vmSize": "standard_A1_v2",
	"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"
		}
	},
		"targetDedicatedNodes": 1,
	"networkConfiguration": {
		"subnetId":<subnetID>
		}
}

But this file is not accepted in the GUI Add (JSON editor) method of creating a pool. This is very confusing and makes everything much harder to use. Also it is not at all clear from the documentation which structure should be used where or why.

@alfpark alfpark added the under investigation Under investigation by team label Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
under investigation Under investigation by team
Projects
None yet
Development

No branches or pull requests

3 participants