我们有一个拥有大量虚拟机的Azure帐户。我需要一个脚本,可以列出所有具有端点的已打开电源的机器 - 并列出端点+ ACL。
我们正在尝试使用开放的SSH端点跟踪服务器,而无需手动执行此操作。我尝试工作的脚本没有用。
Get-AzureVM |其中{$ _。状态-ne" ReadyRole"} | Get-AzureEndpoint |选择LocalPort,Port,Protocol,Vip,Acl,VirtualIPName
谢谢!
答案 0 :(得分:0)
您需要逐步浏览每个VM的端点:
$ReadyVMs = Get-AzureVM | ? Status -eq ReadyRole
ForEach ($VM in $ReadyVMs) {
$EndPoint = $VM | Get-AzureEndpoint
If ($EndPoint.LocalPort -eq 22) { #or whatever port you need
If (($EndPoint.Acl).Count -gt 0) {
$EndPoint.Acl
}
Else {
Write-Host "No ACL found for $($EndPoint.Name) on $($VM.Name)"
}
}
}