次の方法で共有


Batch プールで拡張機能を使用する

拡張機能は、プロビジョニング後の構成とバッチ計算ノードでのセットアップを容易にする小規模なアプリケーションです。 許可される拡張機能のいずれかを選択し、プロビジョニング時にコンピューティング ノードにインストールできます。 その後、その拡張機能で目的の操作を実行できます。

検出、修正、または診断の機能を追跡するために、使用する拡張機能のライブ状態を確認し、それによって返された情報を取得できます。

前提条件

  • 拡張機能が使用されているプールでは仮想マシン構成を使用する必要があります。
  • CustomScript 拡張機能の種類は Azure Batch サービス用に予約されているため、オーバーライドできません。
  • 一部の拡張機能では、適切に機能するために、コンピューティング ノードのコンテキストでアクセス可能なプールレベルのマネージド ID が必要な場合があります。 拡張機能に該当する場合は、「Batch プールでマネージド ID を構成する」を参照してください。

ヒント

拡張機能を既存のプールに追加することはできません。 拡張機能を追加、削除、または更新するには、プールを再作成する必要があります。

サポートされる拡張機能

次の拡張機能は、現在 Batch プールを作成するときにインストールできます。

サポート リクエストを開いて、他のパブリッシャーや拡張機能の種類に対するサポートを要請できます。

拡張機能を使用してプールを作成する

下の例では、Azure Key Vault 拡張機能が使用される Linux/Windows ノードの Batch プールを作成します。

REST API URI

 PUT https://management.azure.com/subscriptions/<subscriptionId>/resourceGroups/<resourceGroup>/providers/Microsoft.Batch/batchAccounts/<batchaccountName>/pools/<batchpoolName>?api-version=2021-01-01

Linux ノードの要求本文

{
  "name": "test1",
  "type": "Microsoft.Batch/batchAccounts/pools",
  "properties": {
    "vmSize": "STANDARD_D2S_V5",
    "taskSchedulingPolicy": {
      "nodeFillType": "Pack"
    },
    "deploymentConfiguration": {
      "virtualMachineConfiguration": {
        "imageReference": {
          "publisher": "Canonical",
          "offer": "ubuntu-24_04-lts",
          "sku": "server",
          "version": "latest"
        },
        "nodeAgentSkuId": "batch.node.ubuntu 24.04",
        "extensions": [
          {
            "name": "secretext",
            "type": "KeyVaultForLinux",
            "publisher": "Microsoft.Azure.KeyVault",
            "typeHandlerVersion": "3.0",
            "autoUpgradeMinorVersion": true,
            "settings": {
              "secretsManagementSettings": {
                "pollingIntervalInS": "300",
                "certificateStoreLocation": "/var/lib/waagent/Microsoft.Azure.KeyVault",
                "requireInitialSync": true,
                "observedCertificates": [
                  "https://testkvwestus2.vault.azure.net/secrets/authsecreat"
                ]
              },
              "authenticationSettings": {
                "msiEndpoint": "http://169.254.169.254/metadata/identity",
                "msiClientId": "885b1a3d-f13c-4030-afcf-9f05044d78dc"
              }
            },
            "protectedSettings": {}
          }
        ]
      }
    },
    "scaleSettings": {
      "fixedScale": {
        "targetDedicatedNodes": 1,
        "targetLowPriorityNodes": 0,
        "resizeTimeout": "PT15M"
      }
    }
  },
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/ACR/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testumaforpools": {}
    }
  }
}

Windows ノードの要求本文

{
    "name": "test1",
    "type": "Microsoft.Batch/batchAccounts/pools",
    "properties": {
        "vmSize": "STANDARD_D4S_V5",
        "taskSchedulingPolicy": {
            "nodeFillType": "Pack"
        },
        "deploymentConfiguration": {
            "virtualMachineConfiguration": {
                "imageReference": {
                    "publisher": "microsoftwindowsserver",
                    "offer": "windowsserver",
                    "sku": "2025-datacenter",
                    "version": "latest"
                },
                "nodeAgentSkuId": "batch.node.windows amd64",
                "extensions": [
                    {
                        "name": "secretext",
                        "type": "KeyVaultForWindows",
                        "publisher": "Microsoft.Azure.KeyVault",
                        "typeHandlerVersion": "3.0",
                        "autoUpgradeMinorVersion": true,
                        "settings": {
                            "secretsManagementSettings": {
                                "pollingIntervalInS": "300",
                                "requireInitialSync": true,
                                "observedCertificates": [
                                    {
                                        "https://testkvwestus2.vault.azure.net/secrets/authsecreat"
                                        "certificateStoreLocation": "LocalMachine",
                                        "keyExportable": true
                                    }
                                ]
                            },
                            "authenticationSettings": {
                                "msiEndpoint": "http://169.254.169.254/metadata/identity",
                                "msiClientId": "885b1a3d-f13c-4030-afcf-9f05044d78dc"
                            }
                        },
                        "protectedSettings":{}
                    }
                ]
            }
        },
        "scaleSettings": {
            "fixedScale": {
                "targetDedicatedNodes": 1,
                "targetLowPriorityNodes": 0,
                "resizeTimeout": "PT15M"
            }
        }
    },
    "identity": {
        "type": "UserAssigned",
        "userAssignedIdentities": {
            "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/ACR/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testumaforpools": {}
        }
    }
}

プールから拡張機能データを取得する

次の例では、Azure Key Vault 拡張機能からデータを取得します。

REST API URI

 GET https://<accountName>.<region>.batch.azure.com/pools/<poolName>/nodes/<tvmNodeName>/extensions/secretext?api-version=2010-01-01

応答本文

{
  "odata.metadata": "https://testwestus2batch.westus2.batch.azure.com/$metadata#extensions/@Element",
  "instanceView": {
    "name": "secretext",
    "statuses": [
      {
        "code": "ProvisioningState/succeeded",
        "level": 0,
        "displayStatus": "Provisioning succeeded",
        "message": "Successfully started Key Vault extension service. 2021-02-08T19:49:39Z"
      }
    ]
  },
  "vmExtension": {
    "name": "KVExtensions",
    "publisher": "Microsoft.Azure.KeyVault",
    "type": "KeyVaultForLinux",
    "typeHandlerVersion": "1.0",
    "autoUpgradeMinorVersion": true,
    "settings": "{\r\n  \"secretsManagementSettings\": {\r\n    \"pollingIntervalInS\": \"300\",\r\n    \"certificateStoreLocation\": \"/var/lib/waagent/Microsoft.Azure.KeyVault\",\r\n    \"requireInitialSync\": true,\r\n    \"observedCertificates\": [\r\n      \"https://testkvwestus2.vault.azure.net/secrets/testumi\"\r\n    ]\r\n  },\r\n  \"authenticationSettings\": {\r\n    \"msiEndpoint\": \"http://169.254.169.254/metadata/identity\",\r\n    \"msiClientId\": \"885b1a3d-f13c-4030-afcf-922f05044d78dc\"\r\n  }\r\n}"
  }
}

Key Vault 拡張機能のトラブルシューティング

Key Vault 拡張機能が正しく構成されていない場合、コンピューティング ノードが使用できる状態になっている可能性があります。 Key Vault 拡張機能のエラーのトラブルシューティングを行うには、 requireInitialSync を一時的に false に設定し、プールを再デプロイします。 コンピューティング ノードがアイドル状態になったら、コンピューティング ノードにログインして、KeyVault 拡張機能ログでエラーを確認し、構成の問題を修正できます。 詳細については、次の Key Vault 拡張機能ドキュメントのリンクを参照してください。

Application Health 拡張機能に関する考慮事項

ノードで実行されている Batch ノード エージェントは、エージェントの正常性状態を返す HTTP サーバーを常に起動します。 この HTTP サーバーは、ローカル IP アドレス 127.0.0.1 とポート 29879 でリッスンします。 常に 200 状態を返しますが、応答本文は正常であることも異常であることもあります。 その他の応答 (またはその欠如) は、"不明" 状態と見なされます。 このセットアップは、公式の "Application Health 拡張機能" ドキュメントに従って "Rich Health State" を提供する HTTP サーバーを実行するガイドラインに従っています。

独自の正常性サーバーを設定する場合は、HTTP サーバーが一意のポートでリッスンしていることを確認します。 正常性サーバーでは、Batch Node エージェント サーバーに対してクエリを実行し、正常性シグナルと組み合わせて複合正常性の結果を生成する必要があります。 そうしないと、正常に機能する Batch エージェントを持たない "正常な" ノードになる可能性があります。

次のステップ