$vms = get-azurermvm
$nics = get-azurermnetworkinterface | where VirtualMachine -NE $null #skip Nics with no VM
foreach($nic in $nics)
{
$vm = $vms | where-object -Property Id -EQ $nic.VirtualMachine.id
$vmSize=$vm.HardwareProfile.VmSize
$rg=$vm.ResourceGroupName
#$nicId = $nic.id
$NIC_name = $nic.id.Substring($nic.id.LastIndexOf('/') + 1)
$prv = $nic.IpConfigurations | select-object -ExpandProperty PrivateIpAddress
$alloc = $nic.IpConfigurations | select-object -ExpandProperty PrivateIpAllocationMethod
$pipId = $nic.IpConfigurations[0].PublicIpAddress.Id | where $nic.IpConfigurations.Count -NE 0
if ( $pipId)
{
$pipName = $pipId.Substring($pipId.LastIndexOf('/') + 1) |where $pipId -NE 0
$pipAddr = Get-AzureRmPublicIpAddress -Name $pipName -ResourceGroupName $rg
$pip=$pipAddr.IpAddress
Write-Output "$rg, $($vm.Location),$($vm.Name) : $vmSize, $NIC_name : $prv , $pip"
}
else
{
Write-Output "$rg, $($vm.Location),$($vm.Name) : $vmSize, $NIC_name : $prv "
}
}
查看azure 公网ip 等
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 1、IP-Prefix 题号:47、54、56、61、111、178、208、233、288 2、display ...
- 我是用mysy2移植的linux部分命令环境当然你们可以用别的 MSYS2 环境搭建、官网 curl ip.cnc...
- 1,top命令。 1)进程是资源分配的最小单位。比如Linux下每个进程约有1/100s的时间片执行命令,由于操作...
- 据台湾媒体报道,22日,林依晨为弟弟林维圣的新餐厅“羽乐欧陆创意料理”站台,并透露会趁圣诞节的时候,与老公林于超一...