Unable to create batch pool:
> az login
> az account set --subscription $myid
> az batch account set --resource-group $resourceGroupName --name $batchAccountName
> az batch pool create --json-file pool.json
usage: az batch pool create [-h] [--verbose] [--debug]
[--output {json,jsonc,table,tsv,yaml,none}]
[--query JMESPATH] [--id ID] [--vm-size VM_SIZE]
[--os-family {2,3,4,5}] [--os-version OS_VERSION]
[--node-agent-sku-id NODE_AGENT_SKU_ID]
[--resize-timeout RESIZE_TIMEOUT]
[--target-dedicated-nodes TARGET_DEDICATED_NODES]
[--target-low-priority-nodes TARGET_LOW_PRIORITY_NODES]
[--auto-scale-formula AUTO_SCALE_FORMULA]
[--enable-inter-node-communication]
[--start-task-command-line START_TASK_COMMAND_LINE]
[--start-task-resource-files START_TASK_RESOURCE_FILES [START_TASK_RESOURCE_FILES ...]]
[--start-task-wait-for-success]
[--certificate-references CERTIFICATE_REFERENCES [CERTIFICATE_REFERENCES ...]]
[--application-package-references APPLICATION_PACKAGE_REFERENCES [APPLICATION_PACKAGE_REFERENCES ...]]
[--application-licenses APPLICATION_LICENSES [APPLICATION_LICENSES ...]]
[--max-tasks-per-node MAX_TASKS_PER_NODE]
[--metadata METADATA [METADATA ...]]
[--json-file JSON_FILE]
[--account-name ACCOUNT_NAME]
[--account-key ACCOUNT_KEY]
[--account-endpoint ACCOUNT_ENDPOINT]
[--image IMAGE] [--subscription _SUBSCRIPTION]
az batch pool create: error: 'NoneType' object has no attribute 'startswith'
Content of pool.json: Azure documentation
I just noticed I am getting the same error with other batch pool commands:
C:\Users\>az batch pool list
usage: az batch pool list [-h] [--verbose] [--debug]
[--output {json,jsonc,table,tsv,yaml,none}]
[--query JMESPATH] [--filter FILTER]
[--select SELECT] [--expand EXPAND]
[--account-name ACCOUNT_NAME]
[--account-key ACCOUNT_KEY]
[--account-endpoint ACCOUNT_ENDPOINT]
[--subscription _SUBSCRIPTION]
az batch pool list: error: 'NoneType' object has no attribute 'startswith'
I have reinstalled azure cli again but no difference.
For your issue, I can reappear the same error as you:
That is because you need to log in with the Batch account, not only log in with Azure CLI.
You can see the description in Manage Batch resources with Azure CLI, it shows this:
To use the Azure CLI with Batch, you need to log in and authenticate. There are two simple steps to follow:
- Log into Azure. Logging into Azure gives you access to Azure Resource Manager commands, including Batch Management service commands.
- Log into your Batch account. Logging into your Batch account gives you access to Batch service commands.
So I think the possible reason is that you also need to log in the Batch account.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With