List of inbound NAT rule port mappings.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping?api-version=2023-06-01
URI Parameters
Name |
In |
Required |
Type |
Description |
backendPoolName
|
path |
True
|
string
|
The name of the load balancer backend address pool.
|
groupName
|
path |
True
|
string
|
The name of the resource group.
|
loadBalancerName
|
path |
True
|
string
|
The name of the load balancer.
|
subscriptionId
|
path |
True
|
string
|
The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client API version.
|
Request Body
Name |
Type |
Description |
ipAddress
|
string
|
IP address set in load balancer backend address.
|
ipConfiguration
|
SubResource
|
NetworkInterfaceIPConfiguration set in load balancer backend address.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
Query inbound NAT rule port mapping
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/bp1/queryInboundNatRulePortMapping?api-version=2023-06-01
{
"ipAddress": "10.0.0.4"
}
import com.azure.resourcemanager.network.models.QueryInboundNatRulePortMappingRequest;
/**
* Samples for LoadBalancers ListInboundNatRulePortMappings.
*/
public final class Main {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/
* QueryInboundNatRulePortMapping.json
*/
/**
* Sample code: Query inbound NAT rule port mapping.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void queryInboundNATRulePortMapping(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getLoadBalancers().listInboundNatRulePortMappings("rg1", "lb1",
"bp1", new QueryInboundNatRulePortMappingRequest().withIpAddress("10.0.0.4"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python query_inbound_nat_rule_port_mapping.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.load_balancers.begin_list_inbound_nat_rule_port_mappings(
group_name="rg1",
load_balancer_name="lb1",
backend_pool_name="bp1",
parameters={"ipAddress": "10.0.0.4"},
).result()
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/QueryInboundNatRulePortMapping.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/QueryInboundNatRulePortMapping.json
func ExampleLoadBalancersClient_BeginListInboundNatRulePortMappings() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewLoadBalancersClient().BeginListInboundNatRulePortMappings(ctx, "rg1", "lb1", "bp1", armnetwork.QueryInboundNatRulePortMappingRequest{
IPAddress: to.Ptr("10.0.0.4"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.BackendAddressInboundNatRulePortMappings = armnetwork.BackendAddressInboundNatRulePortMappings{
// InboundNatRulePortMappings: []*armnetwork.InboundNatRulePortMapping{
// {
// BackendPort: to.Ptr[int32](3389),
// FrontendPort: to.Ptr[int32](3389),
// InboundNatRuleName: to.Ptr("natRule"),
// Protocol: to.Ptr(armnetwork.TransportProtocolTCP),
// }},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to List of inbound NAT rule port mappings.
*
* @summary List of inbound NAT rule port mappings.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/QueryInboundNatRulePortMapping.json
*/
async function queryInboundNatRulePortMapping() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const groupName = "rg1";
const loadBalancerName = "lb1";
const backendPoolName = "bp1";
const parameters = {
ipAddress: "10.0.0.4",
};
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.loadBalancers.beginListInboundNatRulePortMappingsAndWait(
groupName,
loadBalancerName,
backendPoolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Network.Models;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-06-01/examples/QueryInboundNatRulePortMapping.json
// this example is just showing the usage of "LoadBalancers_ListInboundNatRulePortMappings" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BackendAddressPoolResource created on azure
// for more information of creating BackendAddressPoolResource, please refer to the document of BackendAddressPoolResource
string subscriptionId = "subid";
string groupName = "rg1";
string loadBalancerName = "lb1";
string backendPoolName = "bp1";
ResourceIdentifier backendAddressPoolResourceId = BackendAddressPoolResource.CreateResourceIdentifier(subscriptionId, groupName, loadBalancerName, backendPoolName);
BackendAddressPoolResource backendAddressPool = client.GetBackendAddressPoolResource(backendAddressPoolResourceId);
// invoke the operation
QueryInboundNatRulePortMappingContent content = new QueryInboundNatRulePortMappingContent()
{
IPAddress = "10.0.0.4",
};
ArmOperation<BackendAddressInboundNatRulePortMappings> lro = await backendAddressPool.GetInboundNatRulePortMappingsLoadBalancerAsync(WaitUntil.Completed, content);
BackendAddressInboundNatRulePortMappings result = lro.Value;
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"inboundNatRulePortMappings": [
{
"inboundNatRuleName": "natRule",
"protocol": "Tcp",
"frontendPort": 3389,
"backendPort": 3389
}
]
}
Location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/bp1/queryInboundNatRulePortMapping?api-version=2023-06-01
{
"inboundNatRulePortMappings": [
{
"inboundNatRuleName": "natRule",
"protocol": "Tcp",
"frontendPort": 3389,
"backendPort": 3389
}
]
}
Definitions
BackendAddressInboundNatRulePortMappings
The response for a QueryInboundNatRulePortMapping API.
CloudError
An error response from the service.
CloudErrorBody
An error response from the service.
Name |
Type |
Description |
code
|
string
|
An identifier for the error. Codes are invariant and are intended to be consumed programmatically.
|
details
|
CloudErrorBody[]
|
A list of additional details about the error.
|
message
|
string
|
A message describing the error, intended to be suitable for display in a user interface.
|
target
|
string
|
The target of the particular error. For example, the name of the property in error.
|
InboundNatRulePortMapping
Individual port mappings for inbound NAT rule created for backend pool.
Name |
Type |
Description |
backendPort
|
integer
|
Backend port.
|
frontendPort
|
integer
|
Frontend port.
|
inboundNatRuleName
|
string
|
Name of inbound NAT rule.
|
protocol
|
TransportProtocol
|
The reference to the transport protocol used by the inbound NAT rule.
|
QueryInboundNatRulePortMappingRequest
The request for a QueryInboundNatRulePortMapping API. Either IpConfiguration or IpAddress should be set
Name |
Type |
Description |
ipAddress
|
string
|
IP address set in load balancer backend address.
|
ipConfiguration
|
SubResource
|
NetworkInterfaceIPConfiguration set in load balancer backend address.
|
SubResource
Reference to another subresource.
Name |
Type |
Description |
id
|
string
|
Resource ID.
|
TransportProtocol
The transport protocol for the endpoint.
Name |
Type |
Description |
All
|
string
|
|
Tcp
|
string
|
|
Udp
|
string
|
|