面向负载均衡器的 Azure Public

Azure Public facing Loadbalancers

我想列出 Azure 中所有具有 public IP 地址的负载均衡器,但我只得到一个子集,而不是整个结果。

 var credentials = SdkContext.AzureCredentialsFactory
                                          .FromServicePrincipal(clientId, secret,
                                           tenantId, AzureEnvironment.AzureGlobalCloud);

var azure = Microsoft.Azure.Management.Fluent.Azure
                                .Configure()
                               .Authenticate(credentials).WithDefaultSubscription();

foreach (var subscription in azure.Subscriptions.List())
{
      var loadbalancers = azure.LoadBalancers;

      foreach (var loadbalancer in loadbalancers.List())
      {
        if (loadbalancer.PublicFrontends.Count >= 1)
        {
          writelog("load balancer:" + loadbalancer.Name);
        }
      }
}

您需要对每个订阅进行身份验证,然后获取负载均衡器列表。