2017-09-07 17 views
0

我想使用c#为“用户订阅”创建Azure批处理作业池我没有看到一个示例,可以指定哪个Vnet来设置节点。我不是没有看到任何CreatePool选项来设置互联星空Azure批处理作业:使用C#为用户订阅类型创建池

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")); 

用户订阅:创建池

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)); 

感谢

回答

1

你需要CloudPool.NetworkConfiguration。这允许您指定一个SubnetId,它是一个包含vnet和子网名称的ARM ID。更多详细信息,请访问:https://docs.microsoft.com/en-us/rest/api/batchservice/add-a-pool-to-an-account#bk_netconf

但是,如果您处于UserSubscription帐户中,我相信您无法使用cloudServiceConfiguration。见https://docs.microsoft.com/en-us/rest/api/batchservice/add-a-pool-to-an-account。改用virtualMachineConfiguration。

+0

用virtualMachineConfiguration更新可以请你分享一个片段,在哪里添加网络信息? – kumar

相关问题