I want to list all loadbalancers in Azure which have public IP address but I get only a subset and not the entire result.
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);
}
}
}
You need to authenticate to each subscription and then get the list of load balancer.