Create a Batch AI instance with a file share from the Azure CLI

While working with the Azure Batch AI public preview I was unable to use the portal to create a Batch AI instance that was connected to a file share.  I suspect this is just a bug in the preview, but I wanted to share exactly how I did it so others don’t have to figure this out themselves.

The only problem with doing this from the command line is that the Azure CLI does not support specifying VM Priority.  Since I wanted low priority VM’s and that is not the default I had to pass a switch that allows you to patch the object model directly with a json file.  Create clusterconfig.json:


Next execute the following command at the Azure CLI:

az batchai cluster create –name neuralnetwork –image UbuntuDSVM –vm-size Standrd_NC6 –min 0 –max 1 –afs-name data –user-name <MyUsername> –password <MyPassword> -c clusterconfig.json –resource-group tensorflow2 –location westus2 –storage-account-name tensorflowdata –storage-account-key <MyStorageAccountKey>

view raw


hosted with ❤ by GitHub

Notice the reference to clusterconfig.json, which overrides the objectmodel property vmPriority.  Also note that you need to replace the values for <MyUsername>, <MyPassword>, and <MyStorageAccountKey>.  You likely want to change the resource group, storage-account-name, etc to match your resources / naming scheme.


After a few minutes you should have a Batch AI cluster up and running ready for use, and with a lot less effort then creating it in the portal.

Leave a Reply