def create_lb_with_nat_pool(access_token, subscription_id, resource_group, lb_name, public_ip_id,
                            fe_start_port, fe_end_port, backend_port, location):
    '''Create a load balancer with inbound NAT pools.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.
        lb_name (str): Name of the new load balancer.
        public_ip_id (str): Public IP address resource id.
        fe_start_port (int): Start of front-end port range.
        fe_end_port (int): End of front-end port range.
        backend_port (int): Back end port for VMs.
        location (str): Azure data center location. E.g. westus.

    Returns:
        HTTP response. Load Balancer JSON body.
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/resourceGroups/', resource_group,
                        '/providers/Microsoft.Network/loadBalancers/', lb_name,
                        '?api-version=', NETWORK_API])
    lb_body = {'location': location}
    frontendipcconfig = {'name': 'LoadBalancerFrontEnd'}
    fipc_properties = {'publicIPAddress': {'id': public_ip_id}}
    frontendipcconfig['properties'] = fipc_properties
    properties = {'frontendIPConfigurations': [frontendipcconfig]}
    properties['backendAddressPools'] = [{'name': 'bepool'}]
    inbound_natpool = {'name': 'natpool'}
    lbfe_id = '/subscriptions/' + subscription_id + '/resourceGroups/' + resource_group + \
        '/providers/Microsoft.Network/loadBalancers/' + lb_name + \
        '/frontendIPConfigurations/LoadBalancerFrontEnd'
    ibnp_properties = {'frontendIPConfiguration': {'id': lbfe_id}}
    ibnp_properties['protocol'] = 'tcp'
    ibnp_properties['frontendPortRangeStart'] = fe_start_port
    ibnp_properties['frontendPortRangeEnd'] = fe_end_port
    ibnp_properties['backendPort'] = backend_port
    inbound_natpool['properties'] = ibnp_properties
    properties['inboundNatPools'] = [inbound_natpool]
    lb_body['properties'] = properties
    body = json.dumps(lb_body)
    return do_put(endpoint, body, access_token)
def create_lb_with_nat_pool ( access_token , subscription_id , resource_group , lb_name , public_ip_id , fe_start_port , fe_end_port , backend_port , location ) : endpoint = '' . join ( [ get_rm_endpoint ( ) , '/subscriptions/' , subscription_id , '/resourceGroups/' , resource_group , '/providers/Microsoft.Network/loadBalancers/' , lb_name , '?api-version=' , NETWORK_API ] ) lb_body = { 'location' : location } frontendipcconfig = { 'name' : 'LoadBalancerFrontEnd' } fipc_properties = { 'publicIPAddress' : { 'id' : public_ip_id } } frontendipcconfig [ 'properties' ] = fipc_properties properties = { 'frontendIPConfigurations' : [ frontendipcconfig ] } properties [ 'backendAddressPools' ] = [ { 'name' : 'bepool' } ] inbound_natpool = { 'name' : 'natpool' } lbfe_id = '/subscriptions/' + subscription_id + '/resourceGroups/' + resource_group + '/providers/Microsoft.Network/loadBalancers/' + lb_name + '/frontendIPConfigurations/LoadBalancerFrontEnd' ibnp_properties = { 'frontendIPConfiguration' : { 'id' : lbfe_id } } ibnp_properties [ 'protocol' ] = 'tcp' ibnp_properties [ 'frontendPortRangeStart' ] = fe_start_port ibnp_properties [ 'frontendPortRangeEnd' ] = fe_end_port ibnp_properties [ 'backendPort' ] = backend_port inbound_natpool [ 'properties' ] = ibnp_properties properties [ 'inboundNatPools' ] = [ inbound_natpool ] lb_body [ 'properties' ] = properties body = json . dumps ( lb_body ) return do_put ( endpoint , body , access_token )
Create a load balancer with inbound NAT pools.

    Args:
        access_token (str): A valid Azure authentication token.
        subscription_id (str): Azure subscription id.
        resource_group (str): Azure resource group name.
        lb_name (str): Name of the new load balancer.
        public_ip_id (str): Public IP address resource id.
        fe_start_port (int): Start of front-end port range.
        fe_end_port (int): End of front-end port range.
        backend_port (int): Back end port for VMs.
        location (str): Azure data center location. E.g. westus.

    Returns:
        HTTP response. Load Balancer JSON body.