Question

darkeagle1239 on Sat, 31 Mar 2018 18:21:13


Hi,

I have a little problems here.

When i try to create a batch pool using Powershell on my computer with Azure CLI installed, i tried 

az batch pool create --json-file jsonfile.json

but i don't know where should i store my .json file ?


Sponsored



Replies

Tats Mishra MSFT on Sun, 01 Apr 2018 08:14:43


Hiya,

Please take look into these documents which are about adding pool using jsonfile in az batch cli (These probably will help to better understand):

  • https://docs.microsoft.com/en-us/azure/batch/batch-cli-get-started#json-files-for-resource-creation 
  • https://docs.microsoft.com/en-nz/rest/api/batchservice/pool/add 
  • https://docs.microsoft.com/en-us/azure/batch/batch-cli-get-started#json-files-for-resource-creation 

Going back to the question:

  • I suppose "your_json_file_location.json", I think is the location of your json file in your project structure.

Hope this helps.

Thanks,

^Tats

darkeagle1238 on Sun, 01 Apr 2018 18:15:04


Hi,

I tried to put my json file into C disk drive in my computer and i ran : 

az batch pool create --json-file "C:\batchpool.json"
And i got this error 
az batch pool create: error: Invalid JSON file: Expecting property name enclosed in double quotes: line 10 column 5 (char 266)

I tried to remove double quotes but got the same result

Tats Mishra MSFT on Mon, 02 Apr 2018 20:27:48


This is not batch but the most probably malformed JSON source error:

  • Re: malformed Json Error: "InvalidJSON file: Expectingproperty name enclosed in doublequotes"
  • The JSON in use is not valid JSON (i.e. batchpool.json is not correctly formed). You need to fix the source of the data. Please see just for an example here.
  • *Further help* Just for a sample based help.
  • Checkout this out: I found a small demo in this link, you might be able to see a sample use of "az batch pool create --json-file pool.json" : (Please Note: this is merely a sample your use-case scenario will vary)
  • I would also recommend reading previous sent links carefully as well to get yourself familiar with batch and Batch-cli.

Thanks,

^Tats

darkeagle1238 on Wed, 04 Apr 2018 06:16:03


Hi,

I solved that problem

But i have one more question

If i use cloud shell inside Azure portal to run that script, where should i store my .json file ?


Tats Mishra MSFT on Wed, 04 Apr 2018 22:17:02


Glad that it helped you and you were able to resolve it.

Regarding your portal "cloud shell" query: 

All this very much depends on your scenario.

  • I think there could be many ways and apart from few suggestions below I would recommend you to make yourseld familiar first and then ask questions in "azure management portal" forum for best practice. 

Some ways of persisinting files in shell are doc'd here:

Thanks,

^Tats