gpt4 book ai didi

具有动态私有(private) IP : how can I know its current IP? 的 Azure 应用程序网关

转载 作者:行者123 更新时间:2023-12-03 06:24:11 25 4
gpt4 key购买 nike

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

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

因此,此应用程序网关有 1 个公共(public) IP 地址和 1 个私有(private) IP 地址,且 privateIPAllocationMethod": "Dynamic"。但是,我找不到任何 API 调用,也无法在 UI 中找到任何位置可以确定应用程序网关的运行时私有(private)IP地址。有没有办法知道,或者不相关?

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

最佳答案

我尝试在我的环境中重现相同的结果,并得到如下结果:

我使用 privateIPAllocationMethod": "Dynamic" 创建了一个具有 1 个公共(public) IP 地址和 1 个私有(private) IP 地址的 Azure 应用程序网关,如下所示:

enter image description here

按照 Abhinandan Bharamgunde 的建议,我尝试过使用 RestAPI

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

使用 REST API 获取应用程序网关当我通过选择“尝试”来运行请求时,我成功获得了如下结果:

enter image description here

enter image description here

"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?

使用 CLI 检查分配的私有(private) IP 的值:

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

enter image description here

在 powershell 中:

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

enter image description here

在应用程序网关中,单击监听器将前端更改为私有(private),如下所示:

enter image description here

您可以查看前端 IP 配置中分配的公共(public)和私有(private)地址,如下所示:

enter image description here

关于具有动态私有(private) IP : how can I know its current IP? 的 Azure 应用程序网关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75683180/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com