Unable to create a pool under a batch account with 'IP address provisioning type' set to 'NoPublicIPAddresses' [Python SDK]'

Shakeel Khan 0 Reputation points
2024-11-30T14:52:19.9666667+00:00

Hi,

Need help on Pool creation using Python SDK. I have a virtual network and also a subnet in my Azure account. I'm trying to create a pool under an existing batch account.

  1. Through Azure Portal:

When I create it through the Azure portal I do not have any issues. The process is smooth and the pool and nodes are created successfully. I set the 'IP address provisioning type' parameter to 'NoPublicIPAddresses' and it asks me to change the 'Node communication Mode' to 'Simplified' and I do it. A IP is now created within the subnet.

  1. Through Python SDK:

When I try to do the same settings through Python SDK, everything seems right but I get a dumb error which I feel is unrelated.
This is my pool creation function:

def create_pool(batch_service_client: BatchServiceClient, pool_id: str):
    """
    Creates a pool of compute nodes with the specified OS settings.

    :param batch_service_client: A Batch service client.
    :param str pool_id: An ID for the new pool.
    :param str publisher: Marketplace image publisher
    :param str offer: Marketplace image offer
    :param str sku: Marketplace image sku
    """
    print(f'Creating pool [{pool_id}]...')

    # Create a new pool of Linux compute nodes using an Azure Virtual Machines
    # Marketplace image. For more information about creating pools of Linux
    # nodes, see:
    # https://azure.microsoft.com/documentation/articles/batch-linux-nodes/

    # Define the subnet resource ID
    subnet_resource_id = config.SUBNET_ID
    # Configure the network settings
    network_config = batchmodels.NetworkConfiguration(
        subnet_id=subnet_resource_id,
        public_ip_address_configuration=batchmodels.PublicIPAddressConfiguration(
            provision='noPublicIPAddresses'  # Disable public IP addresses
        )
    )

    new_pool = batchmodels.PoolAddParameter(
        id=pool_id,
        virtual_machine_configuration=batchmodels.VirtualMachineConfiguration(
            image_reference=batchmodels.ImageReference(
                
                publisher="microsoftwindowsserver",
                
                offer="windowsserver",
                
                sku="2022-datacenter-smalldisk",
                version="latest"
            ),
            
            node_agent_sku_id="batch.node.windows amd64"
        ),
        user_accounts=[
            batchmodels.UserAccount(
                name="spot",  
                password="Algo&Qua35",
                elevation_level=batchmodels.ElevationLevel.admin
            )
        ],
        vm_size=config.POOL_VM_SIZE,
        target_dedicated_nodes=config.POOL_NODE_COUNT,
        target_low_priority_nodes=config.POOL_LOW_PRIORITY_NODE_COUNT,
        network_configuration=network_config,
        enable_inter_node_communication=False
    )
    batch_service_client.pool.add(new_pool)

And the error I'm receiving with this is below:

The specified subnet acsys-prod-wvd has PrivateLinkServiceNetworkPolicies or PrivateEndpointNetworkPolicies enabled, please disable them to provision NoPublicAddresses Pool

But the annoying part here is that when I look at the subnet's setting in the azure portal for 'Private Endpoint Network Policies', the value is definitely 'DISABLED'.

If someone could through some light on this, I would be very grateful! Thanks in advance!

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
348 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,574 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tamil Selvan M 0 Reputation points
    2024-12-04T03:38:29.1166667+00:00

    Hi Shakeel Khan,

    Kindly verify the Azure SDK Python version you are using. You can reference the below links for guidance:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.