Creating a batch pool throws error

Kiran Arudi 0 Reputation points
2024-02-25T14:26:17.4566667+00:00
            // Create a Windows Server image, VM configuration, Batch pool
            ImageReference imageReference = CreateImageReference();
            VirtualMachineConfiguration vmConfiguration = CreateVirtualMachineConfiguration(imageReference);
            ***CreateBatchPool(batchClient, vmConfiguration);***

Microsoft.Azure.Batch.Common.BatchException HResult=0x80131500 Message=Operation returned an invalid status code 'Conflict' Source=Microsoft.Azure.Batch StackTrace: at Microsoft.Azure.Batch.Protocol.BatchRequestBase`2.

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
302 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 33,471 Reputation points Microsoft Employee
    2024-02-27T18:09:43.6466667+00:00

    @Kiran Arudi

    There are many possibilities to receive the Conflict status code. You can view a list and the reasons here. Did you receive the specific error code? Looking at some of our examples it appears that you could possibly be missing some required parameters. Checkout the example here for more information.

    private static VirtualMachineConfiguration CreateVirtualMachineConfiguration(ImageReference imageReference)
    {
        return new VirtualMachineConfiguration(
            imageReference: imageReference,
            nodeAgentSkuId: "batch.node.windows amd64");
    }
    
    private static ImageReference CreateImageReference()
    {
        return new ImageReference(
            publisher: "MicrosoftWindowsServer",
            offer: "WindowsServer",
            sku: "2016-datacenter-smalldisk",
            version: "latest");
    }
    
    private static void CreateBatchPool(BatchClient batchClient, VirtualMachineConfiguration vmConfiguration)
    {
        try
        {
            CloudPool pool = batchClient.PoolOperations.CreatePool(
                poolId: PoolId,
                targetDedicatedComputeNodes: PoolNodeCount,
                virtualMachineSize: PoolVMSize,
                virtualMachineConfiguration: vmConfiguration);
    
            pool.Commit();
        }
    ...
    

    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.

    Thank you for helping to improve Microsoft Q&A! User's image

    0 comments No comments