I would like to create Azure Batch job pool using c# for "User Subscription" I do not see an example for this where I can specify which Vnet to setup the node. I not not see any option in CreatePool to set the VNet
pool = batchClient.PoolOperations.CreatePool(
poolId: poolId,
targetDedicatedComputeNodes: 3, // 3 compute nodes
virtualMachineSize: "small", // single-core, 1.75 GB memory, 225 GB disk
cloudServiceConfiguration: new CloudServiceConfiguration(osFamily: "4"));
User Subscription: Create Pool
ImageReference imgRef = new ImageReference(offer: "WindowsServer",
publisher: "MicrosoftWindowsServer", sku: "2012-R2-Datacenter");
String nodeAgentSkuId = "batch.node.windows amd64";
pool = batchClient.PoolOperations.CreatePool(
poolId: poolId,
targetDedicatedComputeNodes: 3, // 3 compute nodes
virtualMachineSize: "small", // single-core, 1.75 GB memory, 225 GB disk
virtualMachineConfiguration: new VirtualMachineConfiguration(imgRef, nodeAgentSkuId));
thanks
You need
CloudPool.NetworkConfiguration
. This allows you to specify a SubnetId which is an ARM ID that includes the vnet and subnet names. More details here: https://learn.microsoft.com/en-us/rest/api/batchservice/add-a-pool-to-an-account#bk_netconfHowever, as a heads up, if you are in a UserSubscription account, I believe you can't use cloudServiceConfiguration. See https://learn.microsoft.com/en-us/rest/api/batchservice/add-a-pool-to-an-account. Use virtualMachineConfiguration instead.