【问题标题】:Custom Image under AzureBatch ImageReference class not workingAzureBatch ImageReference 类下的自定义图像不起作用
【发布时间】:2018-09-13 17:07:16
【问题描述】:

我有一个自定义 VHD 文件。我可以通过门户使用我的自定义图像创建池。但我想尝试使用 .Net SDK。但它抛出错误“操作返回了无效的状态代码‘禁止’。

我指的是linkAzure Batch

我可以使用相同的代码从 MarketPlace 图像创建池 下面是我的代码

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
                    }
                }

【问题讨论】:

    标签: azure-batch


    【解决方案1】:

    您需要确保已满足 Azure Batch 中自定义图像的 prerequisites

    1. ARM 映像与 Batch 帐户位于同一订阅和区域中。
    2. 您正在使用 Azure Active Directory 向 Batch 服务进行身份验证。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 2015-02-07
      • 2014-09-30
      • 1970-01-01
      相关资源
      最近更新 更多