Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

huangapple go评论66阅读模式
英文:

Azure Application Gateway with dynamic private IP: how can I know its current IP?

问题

我已经创建了一个Azure应用程序网关,并配置了以下前端配置:

"frontendIPConfigurations": [
    {
        "name": "...",
        "id": "....",
        "etag": "...",
        "type": "Microsoft.Network/applicationGateways/frontendIPConfigurations",
        "properties": {
            "provisioningState": "Succeeded",
            "privateIPAllocationMethod": "Dynamic",
            "publicIPAddress": {
                "id": "..."
            },
            "httpListeners": [
                {
                    "id": "..."
                },
                {
                    "id": "..."
                },
                {
                    "id": "..."
                }
            ]
        }
    }
]

因此,这个应用程序网关具有1个公共IP地址和1个私有IP地址,私有IP分配方法为“Dynamic”。但是,我找不到任何API调用或UI中的位置,可以确定应用程序网关的运行时私有IP地址。是否有办法知道,或者这不相关吗?

用例:在运行时,我需要确定我看到的IP地址(我只有IP和端口)是否是应用程序网关的IP地址,无论是网关的私有IP还是公共IP。我可以轻松地在Azure UI的公共IP部分看到公共IP是什么,但是如何知道动态分配的私有IP的当前值?

英文:

I've created an Azure Application Gateway with the following frontend configurations:

        "frontendIPConfigurations": [
            {
                "name": "...",
                "id": "....",
                "etag": "...",
                "type": "Microsoft.Network/applicationGateways/frontendIPConfigurations",
                "properties": {
                    "provisioningState": "Succeeded",
                    "privateIPAllocationMethod": "Dynamic",
                    "publicIPAddress": {
                        "id": "..."
                    },
                    "httpListeners": [
                        {
                            "id": "..."
                        },
                        {
                            "id": "..."
                        },
                        {
                            "id": "..."
                        }
                    ]
                }
            }
        ]

So this Application Gateway has 1 public IP address, and 1 private IP address with privateIPAllocationMethod": "Dynamic". However, I cannot find any API call, or place in the UI, where I can determine the runtime private IP address of the Application Gateway. Is there a way to know, or is it not relevant?

Use-case: I need, at runtime, to determine if an IP I see (I only have IP and port) is that of an Application Gateway, whether it's the Gateway's private IP, or public IP. I can easily see what's the public IP by going to the Public IPs section in the Azure UI, but how can I know what is the current value of a dynamically allocated private IP?

答案1

得分: 1

以下是您要的中文翻译部分:

"I tried to reproduce the same in my environment and got the results like below:"

我尝试在我的环境中复制相同的操作,并获得了以下结果:

"I created an Azure Application Gateway with 1 public an 1 private Ip address with privateIPAllocationMethod": "Dynamic" like below:"

我创建了一个Azure应用程序网关,其中包含1个公共IP地址和1个私有IP地址,使用如下配置:privateIPAllocationMethod": "Dynamic",如下所示:

"As suggested by Abhinandan Bharamgunde I have tried using RestAPI"

正如Abhinandan Bharamgunde建议的,我尝试使用RestAPI:

"GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}?api-version=2022-09-01"

使用REST API的请求如下:

"To get an Application Gateways using REST API when I run the request by selecting try it I got successfully result like below:"

通过选择“尝试”运行请求后,我成功地获得了以下结果:

"name": "appGwPrivateFrontendIpIPv4",
        "id": "/subscriptions/b83c1ed3-c5b6-44fb-b5ba-2b8xxxxxx/resourceGroups/v-imrankXXX/providers/Microsoft.Network/applicationGateways/imranappgateway/frontendIPConfigurations/appGwPrivateFrontendIpIPv4",
        "etag": "W/\"96528c0d-fb7c-453d-b596-566a9XXXX\"",
        "type": "Microsoft.Network/applicationGateways/frontendIPConfigurations",
        "properties": {
          "provisioningState": "Succeeded",
          "privateIPAddress": "10.0.0.6",
          "privateIPAllocationMethod": "Dynamic",
          "subnet": {
            "id": "/subscriptions/b83c1ed3-c5b6-44fb-b5XXXXX/resourceGroups/20230308173XXXXXX/providers/Microsoft.Network/virtualNetworks/appvnet/subnets/default"
          },
          "httpListeners": [
"name": "appGwPrivateFrontendIpIPv4",
        "id": "/subscriptions/b83c1ed3-c5b6-44fb-b5ba-2b8xxxxxx/resourceGroups/v-imrankXXX/providers/Microsoft.Network/applicationGateways/imranappgateway/frontendIPConfigurations/appGwPrivateFrontendIpIPv4",
        "etag": "W/\"96528c0d-fb7c-453d-b596-566a9XXXX\"",
        "type": "Microsoft.Network/applicationGateways/frontendIPConfigurations",
        "properties": {
          "provisioningState": "Succeeded",
          "privateIPAddress": "10.0.0.6",
          "privateIPAllocationMethod": "Dynamic",
          "subnet": {
            "id": "/subscriptions/b83c1ed3-c5b6-44fb-b5XXXXX/resourceGroups/20230308173XXXXXX/providers/Microsoft.Network/virtualNetworks/appvnet/subnets/default"
          },
          "httpListeners": [

"how can I know what is the current value of a dynamically allocated private IP?"

如何知道当前动态分配的私有IP地址的值?

"To check the value of allocated private Ip using CLI:"

使用CLI检查分配的私有IP地址的值:

az network application-gateway show --name <gateway-name> --resource-group <resource-group-name> --query 'frontendIPConfigurations[].privateIPAddress'

在Powershell中:

(Get-AzApplicationGateway -Name <gateway-name> -ResourceGroupName <resource-group-name>).FrontendIPConfigurations.PrivateIPAddress

在应用程序网关中,点击侦听器并将前端更改为私有,如下所示:

"In App gateway click on listener change frontend end as private like below:"

在应用程序网关中,点击侦听器并将前端更改为私有,如下所示:

"you can able to see public and private address of allocated in Frontend IP configurations like below:"

您可以在前端IP配置中看到已分配的公共和私有地址,如下所示:

英文:

I tried to reproduce the same in my environment and got the results like below:

I created an Azure Application Gateway with 1 public an 1 private Ip address with privateIPAllocationMethod": "Dynamic" like below:

Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

As suggested by Abhinandan Bharamgunde I have tried using RestAPI

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}?api-version=2022-09-01

To get an Application Gateways using REST API when I run the request by selecting try it I got successfully result like below:

Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

"name": "appGwPrivateFrontendIpIPv4",
        "id": "/subscriptions/b83c1ed3-c5b6-44fb-b5ba-2b8xxxxxx/resourceGroups/v-imrankXXX/providers/Microsoft.Network/applicationGateways/imranappgateway/frontendIPConfigurations/appGwPrivateFrontendIpIPv4",
        "etag": "W/\"96528c0d-fb7c-453d-b596-566a9XXXX\"",
        "type": "Microsoft.Network/applicationGateways/frontendIPConfigurations",
        "properties": {
          "provisioningState": "Succeeded",
          "privateIPAddress": "10.0.0.6",
          "privateIPAllocationMethod": "Dynamic",
          "subnet": {
            "id": "/subscriptions/b83c1ed3-c5b6-44fb-b5XXXXX/resourceGroups/20230308173XXXXXX/providers/Microsoft.Network/virtualNetworks/appvnet/subnets/default"
          },
          "httpListeners": [

> how can I know what is the current value of a dynamically allocated private IP?

To check the value of allocated private Ip using CLI:

az network application-gateway show --name <gateway-name> --resource-group <resource-group-name> --query 'frontendIPConfigurations[].privateIPAddress'

Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

In powershell:

(Get-AzApplicationGateway -Name <gateway-name> -ResourceGroupName <resource-group-name>).FrontendIPConfigurations.PrivateIPAddress

Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

In App gateway click on listener change frontend end as private like below:

Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

you can able to see public and private address of allocated in Frontend IP configurations like below:

Azure Application Gateway带有动态私有IP:我如何知道其当前IP?

huangapple
  • 本文由 发表于 2023年3月9日 18:14:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75683180.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定