class_docstr: Hook for Azure Batch APIs.
  
  :param azure_batch_conn_id: :ref:`Azure Batch connection id<howto/connection:azure_batch>`
      of a service principal which will be used to start the container instance.
class_docstr_tok: ["Hook","for","Azure","Batch","APIs",".",":","param","azure_batch_conn_id",":",":","ref",":","`","Azure","Batch","connection","id","<","howto\/connection",":","azure_batch",">","`","of","a","service","principal","which","will","be","used","to","start","the","container","instance","."]
docstr: Configures a pool.
  
  :param pool_id: A string that uniquely identifies the Pool within the Account
  
  :param vm_size: The size of virtual machines in the Pool.
  
  :param display_name: The display name for the Pool
  
  :param target_dedicated_nodes: The desired number of dedicated Compute Nodes in the Pool.
  
  :param use_latest_image_and_sku: Whether to use the latest verified vm image and sku
  
  :param vm_publisher: The publisher of the Azure Virtual Machines Marketplace Image.
      For example, Canonical or MicrosoftWindowsServer.
  
  :param vm_offer: The offer type of the Azure Virtual Machines Marketplace Image.
      For example, UbuntuServer or WindowsServer.
  
  :param sku_starts_with: The start name of the sku to search
  
  :param vm_sku: The name of the virtual machine sku to use
  
  :param vm_version: The version of the virtual machine
  :param vm_version: str
  
  :param vm_node_agent_sku_id: The node agent sku id of the virtual machine
  
  :param os_family: The Azure Guest OS family to be installed on the virtual machines in the Pool.
  
  :param os_version: The OS family version
docstr_tok: ["Configures","a","pool",".",":","param","pool_id",":","A","string","that","uniquely","identifies","the","Pool","within","the","Account",":","param","vm_size",":","The","size","of","virtual","machines","in","the","Pool",".",":","param","display_name",":","The","display","name","for","the","Pool",":","param","target_dedicated_nodes",":","The","desired","number","of","dedicated","Compute","Nodes","in","the","Pool",".",":","param","use_latest_image_and_sku",":","Whether","to","use","the","latest","verified","vm","image","and","sku",":","param","vm_publisher",":","The","publisher","of","the","Azure","Virtual","Machines","Marketplace","Image",".","For","example",",","Canonical","or","MicrosoftWindowsServer",".",":","param","vm_offer",":","The","offer","type","of","the","Azure","Virtual","Machines","Marketplace","Image",".","For","example",",","UbuntuServer","or","WindowsServer",".",":","param","sku_starts_with",":","The","start","name","of","the","sku","to","search",":","param","vm_sku",":","The","name","of","the","virtual","machine","sku","to","use",":","param","vm_version",":","The","version","of","the","virtual","machine",":","param","vm_version",":","str",":","param","vm_node_agent_sku_id",":","The","node","agent","sku","id","of","the","virtual","machine",":","param","os_family",":","The","Azure","Guest","OS","family","to","be","installed","on","the","virtual","machines","in","the","Pool",".",":","param","os_version",":","The","OS","family","version"]
code: def configure_pool(
      self,
      pool_id: str,
      vm_size: str,
      vm_node_agent_sku_id: str,
      vm_publisher: str | None = None,
      vm_offer: str | None = None,
      sku_starts_with: str | None = None,
      vm_sku: str | None = None,
      vm_version: str | None = None,
      os_family: str | None = None,
      os_version: str | None = None,
      display_name: str | None = None,
      target_dedicated_nodes: int | None = None,
      use_latest_image_and_sku: bool = False,
      **kwargs,
  ) -> PoolAddParameter:
      """
      Configures a pool.
  
      :param pool_id: A string that uniquely identifies the Pool within the Account
  
      :param vm_size: The size of virtual machines in the Pool.
  
      :param display_name: The display name for the Pool
  
      :param target_dedicated_nodes: The desired number of dedicated Compute Nodes in the Pool.
  
      :param use_latest_image_and_sku: Whether to use the latest verified vm image and sku
  
      :param vm_publisher: The publisher of the Azure Virtual Machines Marketplace Image.
          For example, Canonical or MicrosoftWindowsServer.
  
      :param vm_offer: The offer type of the Azure Virtual Machines Marketplace Image.
          For example, UbuntuServer or WindowsServer.
  
      :param sku_starts_with: The start name of the sku to search
  
      :param vm_sku: The name of the virtual machine sku to use
  
      :param vm_version: The version of the virtual machine
      :param vm_version: str
  
      :param vm_node_agent_sku_id: The node agent sku id of the virtual machine
  
      :param os_family: The Azure Guest OS family to be installed on the virtual machines in the Pool.
  
      :param os_version: The OS family version
  
      """
      if use_latest_image_and_sku:
          self.log.info(
              "Using latest verified virtual machine image with node agent sku"
          )
          (
              sku_to_use,
              image_ref_to_use,
          ) = self._get_latest_verified_image_vm_and_sku(
              publisher=vm_publisher,
              offer=vm_offer,
              sku_starts_with=sku_starts_with,
          )
          pool = batch_models.PoolAddParameter(
              id=pool_id,
              vm_size=vm_size,
              display_name=display_name,
              virtual_machine_configuration=batch_models.VirtualMachineConfiguration(
                  image_reference=image_ref_to_use,
                  node_agent_sku_id=sku_to_use,
              ),
              target_dedicated_nodes=target_dedicated_nodes,
              **kwargs,
          )
  
      elif os_family:
          self.log.info(
              "Using cloud service configuration to create pool, virtual machine configuration ignored"
          )
          pool = batch_models.PoolAddParameter(
              id=pool_id,
              vm_size=vm_size,
              display_name=display_name,
              cloud_service_configuration=batch_models.CloudServiceConfiguration(
                  os_family=os_family, os_version=os_version
              ),
              target_dedicated_nodes=target_dedicated_nodes,
              **kwargs,
          )
  
      else:
          self.log.info(
              "Using virtual machine configuration to create a pool"
          )
          pool = batch_models.PoolAddParameter(
              id=pool_id,
              vm_size=vm_size,
              display_name=display_name,
              virtual_machine_configuration=batch_models.VirtualMachineConfiguration(
                  image_reference=batch_models.ImageReference(
                      publisher=vm_publisher,
                      offer=vm_offer,
                      sku=vm_sku,
                      version=vm_version,
                  ),
                  node_agent_sku_id=vm_node_agent_sku_id,
              ),
              target_dedicated_nodes=target_dedicated_nodes,
              **kwargs,
          )
      return pool
  
imports: from __future__ import annotations
  import time
  from datetime import timedelta
  from functools import cached_property
  from typing import TYPE_CHECKING, Any
  from azure.batch import BatchServiceClient, batch_auth, models
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.providers.microsoft.azure.utils import AzureIdentityCredentialAdapter, add_managed_identity_connection_widgets, get_field
  from airflow.utils import timezone
label_desc: Use image node_id 7 for calling the AzureBatchHook obj's underlying member method code with example usage: obj.configure_pool(pool_id, vm_size, vm_node_agent_sku_id, vm_publisher, vm_offer, sku_starts_with, vm_sku, vm_version, os_family, os_version, display_name, target_dedicated_nodes, use_latest_image_and_sku) and returns: pool