I want to create a cloudpool with vnet,I typed codes:
1.use AzureAD
Task<string> tokenProvider() => GetAuthenticationTokenAsync();
using BatchClient batchClient = BatchClient.Open(new BatchTokenCredentials(_param.BatchAccountUrl, tokenProvider));
2.Create a pool
CloudPool pool = batchClient.PoolOperations.CreatePool(
poolId: _param.PoolId,
targetDedicatedComputeNodes: _param.DedicatedNodeCount,
virtualMachineSize: _param.PoolVMSize,
virtualMachineConfiguration: vmConfiguration);
pool.NetworkConfiguration = new()
{
SubnetId = $"/subscriptions/{_param.SubscriptionID}/resourceGroups/{_param.ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{_param.VnetName}/subnets/{_param.SubnetName}"
};
pool.TaskSlotsPerNode = 4;
pool.ApplicationPackageReferences = new List<ApplicationPackageReference>
{
new ApplicationPackageReference
{
ApplicationId = _param.AppPackageId,
Version = _param.AppPackageVersion
}
};
pool.Commit();
When pool.Commit(); It return the "BadRequst". but I commented these codes, it's works.
pool.NetworkConfiguration = new()
{
SubnetId = $"/subscriptions/{_param.SubscriptionID}/resourceGroups/{_param.ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{_param.VnetName}/subnets/{_param.SubnetName}"
};
Why?