Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Azure) az batch pool : error: 'NoneType' object has no attribute 'startswith'

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

enter image description here

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.

like image 742
zcahfg2 Avatar asked Apr 03 '19 13:04

zcahfg2


1 Answers

For your issue, I can reappear the same error as you:

enter image description here

That is because you need to log in with the Batch account, not only log in with Azure CLI.

enter image description here

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:

  1. Log into Azure. Logging into Azure gives you access to Azure Resource Manager commands, including Batch Management service commands.
  2. 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.

like image 108
Charles Xu Avatar answered Oct 20 '22 04:10

Charles Xu