gpt4 book ai didi

Azure powershell - 从资源属性中选择子属性

转载 作者:行者123 更新时间:2023-12-03 06:10:35 26 4
gpt4 key购买 nike

我只想在 IPconfigurations/Subnet 下选择名称和 Id,但不知道是否可行。请帮助或指出我正确的方向。

这是命令和输出。


PS C:\Users\aarora> Get-AzVirtualNetworkGateway -ResourceGroupName rg-vwan -Name as-vnet-gateway-rb-s2s


Name : as-vnet-gateway-rb-s2s
ResourceGroupName : rg-vwan
Location : centralus
Id : /subscriptions/xxx/resourceGroups/rg-vwan/providers/Microsoft.Network/virtualNetworkGateways/texas-vnet-gateway-rb-s2s
Etag : W/"76489c17-50c5-49b5-9d65-19280e98718e"
ResourceGuid : e49c4f7f-3123-497e-8257-dd1f8c943e1c
ProvisioningState : Succeeded
Tags :
IpConfigurations : [
{
"PrivateIpAllocationMethod": "Dynamic",
"Subnet": {
"Id": "/subscriptions/xxx/resourceGroups/rg-vwan/providers/Microsoft.Network/virtualNetworks/vnet-am-rb-s2s/subnets/GatewaySubnet"
},
"PublicIpAddress": {
"Id": "/subscriptions/xxx/resourceGroups/rg-vwan/providers/Microsoft.Network/publicIPAddresses/pub-ip-as-rb-s2s"
},
"Name": "default",
"Etag": "W/\"76489c17-50c5-49b5-9d65-19280e98718e\"",
"Id": "/subscriptions/xxx/resourceGroups/rg-vwan/providers/Microsoft.Network/virtualNetworkGateways/as-vnet-gateway-rb-s2s/ipConfigurations/default"
}
]

最佳答案

当我尝试相同的命令时,我得到了相同的结果:

$gatewayInfo = Get-AzVirtualNetworkGateway -ResourceGroupName hedwig -Name vpn1

enter image description here

要在 IPconfigurations/Subnet 下仅选择名称和 Id,请使用以下命令:

Get-AzVirtualNetworkGateway -ResourceGroupName <RGNAME> -Name <vpnNAME> | Select-Object -ExpandProperty IpConfigurations | Select-Object -Property Name, @{Name="SubnetId";Expression={$_.Subnet.Id}}

enter image description here

关于Azure powershell - 从资源属性中选择子属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76848702/

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