【发布时间】:2019-01-15 16:04:52
【问题描述】:
我正在寻找一个 PowerShell 命令,该命令用于列出网络接口卡与其关联的应用程序安全组/资源组之间的关系。我使用以下命令,它只显示 VMName、IPAddress。无法显示应用程序安全组。
我已经使用了 -ExpandProperty ApplicationSecurityGroups 但仍然无法使用。
$nics =Get-AzureRmNetworkInterface -ResourceGroupName "My-RG"
foreach($nic in $nics)
{
$vm = $vms | where-object -Property Id -EQ $nic.VirtualMachine.id
$Name = $nic.Name
$prv = $nic.IpConfigurations | select-object -ExpandProperty PrivateIpAddress
$alloc = $nic.IpConfigurations | select-object -ExpandProperty PrivateIpAllocationMethod
$asc = $nic.IpConfigurations | select-object -ExpandProperty ApplicationSecurityGroups
Write-Output "$Name, $prv , $asc"
}
【问题讨论】:
-
您确定该属性存在吗?
-
只是检查一下,您确定的意思是应用程序安全组,而不是网络安全组吗?它们是两种不同的东西。
标签: azure powershell azure-resource-group