Skip to content

[BUG] Unable to paginate Microsoft.Storage/storageAccounts #49239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ilc-ilopez opened this issue Apr 4, 2025 · 3 comments
Open

[BUG] Unable to paginate Microsoft.Storage/storageAccounts #49239

ilc-ilopez opened this issue Apr 4, 2025 · 3 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)

Comments

@ilc-ilopez
Copy link

Library name and version

Azure.ResourceManager.Storage 1.4.0

Describe the bug

When calling the Azure Management API to list storage accounts using the Microsoft.Storage/storageAccounts resource provider, I am able to successfully retrieve the first page of results. However, any paginated requests using $skipToken fail with a 502 Bad Gateway, returning a ProviderError.

This has been happening since Monday March 31st 2025. I've even updated the client library, previously the call would execute fine.

Expected behavior

We should be able to paginate and get all azure storage accounts in a subscription, and the next page call should work without an HTTP 502 error.

Actual behavior

We receive a 502 Gateway error, exception in the API client, and no results.

First Request

GET /subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts?api-version=2023-05-01 HTTP/1.1
Host: management.azure.com
Authorization: Bearer <REDACTED>
x-ms-client-request-id: 7c999355-82ba-46e2-9a10-a3063f8bd7d9
User-Agent: azsdk-net-ResourceManager.Storage/1.3.0 (.NET 8.0.11; Windows 10)

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
x-ms-request-id: 86375bee-6c1c-4a0d-ae6a-b75322271c4a
x-ms-correlation-request-id: 86375bee-6c1c-4a0d-ae6a-b75322271c4a
Date: Fri, 04 Apr 2025 15:21:29 GMT

{
  "value": [ /* Storage account list */ ],
  "nextLink": "https://management.azure.com/...&$skiptoken=<REDACTED>"
}

Second Request

GET /subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts?$skiptoken=<REDACTED>&api-version=2023-05-01 HTTP/1.1
Host: management.azure.com
Authorization: Bearer <REDACTED>
x-ms-client-request-id: 077205a4-51a7-41ef-b129-e29a858a4d0f
User-Agent: azsdk-net-ResourceManager.Storage/1.3.0 (.NET 8.0.11; Windows 10)

HTTP/1.1 502 Bad Gateway
Content-Type: application/json; charset=utf-8
x-ms-request-id: 4cfb6037-df08-4f2b-be81-aa6fad4aec48
x-ms-correlation-request-id: 4cfb6037-df08-4f2b-be81-aa6fad4aec48
x-ms-routing-request-id: WESTUS:20250404T152131Z:4cfb6037-df08-4f2b-be81-aa6fad4aec48
Date: Fri, 04 Apr 2025 15:21:30 GMT

{
  "error": {
    "code": "ProviderError",
    "message": "Resource provider 'Microsoft.Storage' failed to return collection response for type 'storageAccounts'."
  }
}

Reproduction Steps

I'm using the following method

public static AsyncPageable<StorageAccountResource> GetStorageAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)

My code snippet

var all_storage_accts = new List<StorageAccountResource>();
await foreach (var acct in arm_client.GetSubscriptionResource(subscription_id_ref_obj).GetStorageAccountsAsync())
{
    all_storage_accts.Add(acct);
}

Environment

Windows 11
Visual Studio 17.12.3
TargetFramework NET8

dotnet --info
.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.12+1cce77968

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.101\

.NET workloads installed:
[aspire]
Installation Source: VS 17.12.35527.113
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi

[maui-windows]
Installation Source: VS 17.12.35527.113
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.0\WorkloadManifest.json
Install Type: Msi

[maccatalyst]
Installation Source: VS 17.12.35527.113
Manifest Version: 18.1.9163/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.1.9163\WorkloadManifest.json
Install Type: Msi

[ios]
Installation Source: VS 17.12.35527.113
Manifest Version: 18.1.9163/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.1.9163\WorkloadManifest.json
Install Type: Msi

[android]
Installation Source: VS 17.12.35527.113
Manifest Version: 35.0.7/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.7\WorkloadManifest.json
Install Type: Msi

Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4

.NET SDKs installed:
9.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 4, 2025
@jsquire jsquire added Storage Storage Service (Queues, Blobs, Files) Service Attention Workflow: This issue is responsible by Azure service team. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. Service Attention Workflow: This issue is responsible by Azure service team. labels Apr 4, 2025
@jsquire
Copy link
Member

jsquire commented Apr 4, 2025

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@ilc-ilopez
Copy link
Author

ilc-ilopez commented Apr 8, 2025

I opened an Azure Support ticket ID 2504080010001748
I will report here if I hear anything from Azure Support

There was a response over at Q&A: https://learn.microsoft.com/en-us/answers/questions/2244184/azure-management-api-providererror-502-when-paging

Khadeer Ali
Follow
4,590 Reputation points• Microsoft External Staff
Apr 4, 2025, 9:26 AM
@Israel Lopez ,
Thank you for your detailed analysis and for sharing the request/response information related to the $skipToken issue when listing storage accounts via the Azure Management API.
We acknowledge the issue you’re encountering. Based on your findings — including the consistent 502 errors and the ProviderError returned by the Microsoft.Storage resource provider — this appears to be a backend-side behavior rather than a client-side issue.
I’ve initiated a discussion with our internal team to further investigate this behavior and understand if this is a known issue or requires escalation.
Regarding the pagination behavior: Unfortunately, there isn’t currently a way to override pagination within the Azure Management API. The use of $skipToken is the standard mechanism for paging through large result sets. If that mechanism is failing, as seen here, you may need to rely on the first page of results or consider retrieving data in smaller segments until the issue is resolved.

@ilc-ilopez
Copy link
Author

Here are there responses from Microsoft Paid Support. At least now there is a way to solve this, I don't agree with how the management rest api just fails like this and we have to restart a cloud service?

Hello Israel,
I hope you are having a great day!
My name is XXXXX, and I am the Storage Engineer handling your Support Request 2504080010001748. It is a pleasure to assist you!

After reviewing the case history, I would like to share a workaround to resolve your current issue.

Could you please try re-registering the provider, even if it appears to be registered? To re-register, simply run the following command:

Register-AzResourceProvider -ProviderNamespace Microsoft.Storage

If this workaround does not resolve the issue, you may need to unregister and then register the Microsoft.Storage provider again.
Please let me know if you encounter any issues with this workaround. I am here to assist you. 🙂

Looking forward to your response.
Stay safe.
Best regards,

Hi XXXXX,
Can you explain why we have to do that?
How does that command work, what does it do?
-Israel

Hello Israel!

Thank you for your prompt response!

You have to register again the provider because when new regions are enabled for resource providers, a prior namespace registration is not automatically propagated to newly enabled regions.

The command Register-AzResourceProvider -ProviderNamespace Microsoft.Storage is used in Azure PowerShell to register a resource provider for your Azure subscription.
It ensures that the specified resource provider, in this case, Microsoft.Storage, is available for use within your subscription.

This command registers the Microsoft.Storage resource provider, which is necessary to create and manage storage accounts and other storage-related resources in Azure.

If you encounter issues where certain Azure services or resources are not available, re-registering the resource provider can often resolve these issues by ensuring the provider is correctly registered and up-to-date.

If the initial registration does not resolve the issue, you may need to unregister and then re-register the provider using the following commands:

Unregister the Provider

Unregister-AzResourceProvider -ProviderNamespace Microsoft.Storage

Re-register the Provider

Register-AzResourceProvider -ProviderNamespace Microsoft.Storage

Hope this information is useful for you.

Looking forward to your response.

Stay safe and take care.

Best regards,

Hi XXXXX,
I dont remember registering the provider when I started using the Rest API, did it do this on its own?

You have to register again the provider because when new regions are enabled for resource providers, a prior namespace registration is not automatically propagated to newly enabled regions.

How does new regions get added, is this something I can control? My issue is building apps on the Rest API when it then fails later, which makes support/management difficult to resolve.

Why doesnt the error message indicate this? Or at the very least, self-correct?
-Israel

Hi Israel,

Thank you for your prompt response!
Regarding the provider registration, it is automatically handled when the resource is deployed.
As for the regions, they are managed by the Engineering Product Group, so you won't have control over them.
Concerning the error message you mentioned, here is the error you shared:

{
"error": {
"code": "ProviderError",
"message": "Resource provider 'Microsoft.Storage' failed to return collection response for type 'storageAccounts'."
}
}

This error indicates that the Microsoft.Storage resource provider is not properly registered for your subscription. Therefore, you need to register the provider again. Without proper registration, the resource provider cannot return the necessary collection response for storage accounts, leading to the error you're encountering.
I would appreciate it if you could test the workaround I shared and let me know the results.
Looking forward to your response.

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

3 participants