Skip to content

[BUG] Unable to list Virtual Networks in an Subscription #40302

Open
@ghost

Description

Describe the bug
We are trying to list all the virtual networks for a subscription using the Azure Resource Manager SDK, but the SDK responds with an empty value. If we filter the virtual networks with a Resource Group in the request, then we are getting a correct response and can fetch the virtual networks properly.

We are facing this issue only for a particular subscription "/subscriptions/3e17d1cf-4884-464a-b070-cf240f785b10/". For other subscriptions the API calls are working as intended.

We had raised an Azure Support ticket with tracking id: 2405070010004108 where we were advised to raise a bug report in the Azure Java SDK Github Repo.

Code Snippet
For the API calls from our application, we first initialize the Azure Resource Manager instance as follows:

HttpClient client = new OkHttpAsyncHttpClientBuilder()
						.connectionTimeout(Duration.ofMinutes(5))
						.readTimeout(Duration.ofMinutes(5)).build();
						
AzureResourceManager azureInstance = AzureResourceManager.configure().withRetryPolicy(new RetryPolicy(new FixedDelay(AZURE_SDK_RETRY_POLICY_MAX_RETRIES, delay)))
      .withHttpClient(client)
      .withLogLevel(HttpLogDetailLevel.NONE)
      .authenticate(credentials, profile)
      .withSubscription(this.subscription);

Using this initialized Azure Resource Manager object, we make a call to get all networks in the subscription using:

PagedIterable<Network> networkPagedIterable = azureInstance.networks().list();

This call is returning an empty response even though there are networks in the Azure subscription.

But if we make a call filtering via the resource group, we are getting the correct response from the Azure API

PagedIterable<Network> networkPagedIterable = azureInstance.networks().listByResourceGroup(resourceGroup);

Expected behavior
networks().list() API call should return the list of all the virtual networks in the subscription.

Setup (please complete the following information):

  • OS: Linux
  • IDE: N/A
  • Library/Libraries: com.azure.resourcemanager:azure-resourcemanager:2.21.0
  • Java version: Java 8
  • App Server/Environment: Akka Server / Heroku environment
  • Frameworks: Play Framework with SBT

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Metadata

Metadata

Labels

ARMMgmtThis issue is related to a management-plane library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions