locked
How to create a batch pool using json file ? RRS feed

  • Question

  • 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 ?

    Saturday, March 31, 2018 6:21 PM

All replies

  • 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

    Sunday, April 1, 2018 8:14 AM
  • 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
    Sunday, April 1, 2018 6:15 PM
  • 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

    Monday, April 2, 2018 8:27 PM
  • 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 ?


    Wednesday, April 4, 2018 6:16 AM
  • 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

    Wednesday, April 4, 2018 10:17 PM