遇到问题时,我希望筛选并且只使用与Exchange online特定相关的IP,而不使用其他任何内容。
我可以轻松地获取所有服务的所有is,但目标是只获取Exchange联机服务的is。我尝试过select对象和where对象的变体,但没有成功。
下面是我所做的工作.我没有尝试代码,因为它们从来没有返回任何值
$o365Uri = "https://endpoints.office.com/endpoints/worldwide?clientrequestid=b10c5ed1-bad1-445f-b386-b919946339a7"
$iplist = Invoke-RestMethod $o365Uri
$iplist如果我只想要所有的ips..。
$iplist.ips不过,我只想要一个特定的$iplist.ips,其中serviceArea = Exchange。也可以使用URL代替ips。这两种方法都有效。
发布于 2022-03-23 18:00:32
弄明白了。这只返回交换服务的IPs。
# Call the O365 API to get the IP addresses
$uri = "https://endpoints.office.com/endpoints/worldwide?clientrequestid=b10c5ed1-bad1-445f-b386-b919946339a7"
$call = Invoke-RestMethod $uri
$exchange = $call | where {$_.serviceArea -eq "Exchange"}
$exchangeUrls = $exchange.urlshttps://stackoverflow.com/questions/71590597
复制相似问题