代码之家  ›  专栏  ›  技术社区  ›  user1037747

AzureBatch ImageReference类下的自定义图像不工作

  •  0
  • user1037747  · 技术社区  · 7 年前

    我指的是这个 link

    下面是我的代码

    ImageReference imageReference = new ImageReference("/subscriptions/XXXXXXXXXXXXXXX/resourceGroups/RG-OneGolden/providers/Microsoft.Compute/images/OMGoldenImage");
    
    
                    VirtualMachineConfiguration virtualMachineConfiguration =
                    new VirtualMachineConfiguration(
                        imageReference: imageReference,
                        nodeAgentSkuId: "batch.node.windows amd64");
    
                    try
                    {
                        CloudPool pool = batchClient.PoolOperations.CreatePool(
                            poolId: PoolId,
                            targetDedicatedComputeNodes: PoolNodeCount,
                            virtualMachineSize: PoolVMSize,
                            virtualMachineConfiguration: virtualMachineConfiguration);
    
                        pool.Commit();
                    }
                    catch (BatchException be)
                    {
                        // Accept the specific error code PoolExists as that is expected if the pool already exists
                        if (be.RequestInformation?.BatchError?.Code == BatchErrorCodeStrings.PoolExists)
                        {
                            Console.WriteLine("The pool {0} already existed when we tried to create it", PoolId);
                        }
                        else
                        {
                            throw; // Any other exception is unexpected
                        }
                    }
    
    1 回复  |  直到 7 年前
        1
  •  2
  •   fpark    7 年前

    你需要确保你已经满足了 prerequisites 对于Azure批处理中的自定义图像:

    1. 您正在使用Azure Active Directory对批处理服务进行身份验证。