vscode-azureresourcegroups icon indicating copy to clipboard operation
vscode-azureresourcegroups copied to clipboard

Showing Azure Resources in VSCode is very slow

Open Qythyx opened this issue 1 month ago • 3 comments

There is some problem with showing Azure Resources in VSCode such that it is very slow. The progress indicator at the top of the Resources panel continues animating basically forever and never finishes loading. The Pay-As-You-Go node is shown, and if I click on a sub-node, like Azure Cosmos DB, then the sub-resources are shown, but this can sometimes take 30 seconds or more to show.

I don't know if it is related, but I did notice in the VSCode Output panel for Microsoft Authentication, that authentication log messages repeat continuously. By showing the Debug log level I can see that this happens because of refreshing the token. I don't know if this is intended, but since it happens ever second or so it seems excessive. Below is a example of the logs I'm seeing:

2025-11-18 11:49:42.719 [debug] [Tue, 18 Nov 2025 02:49:42 GMT] : [3ed36095-16ff-40af-a8ed-504a5b00e604] : @azure/[email protected] : Info - Building oauth client configuration with the following authority: https://login.microsoftonline.com/organizations/oauth2/v2.0/token.
2025-11-18 11:49:42.719 [debug] [Tue, 18 Nov 2025 02:49:42 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] : @azure/[email protected] : Info - Overwriting in-memory cache with persistent cache
2025-11-18 11:49:42.724 [debug] [Tue, 18 Nov 2025 02:49:42 GMT] : [3ed36095-16ff-40af-a8ed-504a5b00e604] : @azure/[email protected] : Info - CacheManager:getAccessToken - Returning access token
2025-11-18 11:49:42.725 [debug] [Tue, 18 Nov 2025 02:49:42 GMT] : [3ed36095-16ff-40af-a8ed-504a5b00e604] : @azure/[email protected] : Info - Token refresh is required due to cache outcome: 3
2025-11-18 11:49:42.725 [debug] [Tue, 18 Nov 2025 02:49:42 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] : @azure/[email protected] : Info - CacheManager:getRefreshToken - returning refresh token
2025-11-18 11:49:43.153 [debug] [acquireTokenSilent] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] [499b84ac-1321-427f-aa17-267ca6975798/.default offline_access] [<REDACTED>] got result
2025-11-18 11:49:43.153 [debug] [acquireTokenSilent] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] [499b84ac-1321-427f-aa17-267ca6975798/.default offline_access] [<REDACTED>] firing event due to change

The reason I think the Resources being slow may be related to authentication is because if I sign out of Microsoft and then sign back in then the Resources view quickly loads completely (without the progress animation continuing forever), and when I expand the sub-nodes the expand almost instantly without delayed loading. Similarly, the forever-repeating authentication log messages have stopped. The problem is that this problem returns later. I don't know what causes it to start happening again, it just does after a while.

If there is anything more I can do to help diagnose this, please let me know.

Qythyx avatar Nov 18 '25 02:11 Qythyx

Hmm, I was just able to reproduce the problem. After logging out and back in to Microsoft and having the Resources panel shown without issues I tried clicking the refresh icon for the Resources. This caused the problem, both the loading being slow with the progress indicator loading forever, and the endless authentication token refresh.

AFAIK, the only way for me to recover from this is to re-logout and re-login, but again that would be just a temporary solution.

Qythyx avatar Nov 18 '25 04:11 Qythyx

Thanks for your detailed report of this issue and thanks for your current workaround. It's not ideal, but I hope anyone else running into this can use it.

We are actively working on the performance of the authentication. There's an issue tracking it here.

Do you happen to have a lot of tenants/subscriptions? We've found that the more you have, the more we ping the provider even if those accounts are filtered to not be displayed.

nturinski avatar Nov 19 '25 19:11 nturinski

@nturinski , thanks for the response. I only have 1 tenant, so I don't think my issue is exactly the same as that mentioned in the link you provided. I don't think it is really performance related, just the fact that the authentication token refresh repeats forever. It would be great to try to diagnose why the authentication thinks it needs to refresh the token, but Token refresh is required due to cache outcome: 3 isn't very meaningful to me.

Qythyx avatar Nov 20 '25 02:11 Qythyx

I am having the same problem. Login in and out (through the command panel) didn't do anything for me, neither did disabling and enabling the extension.

kristofrk avatar Dec 01 '25 23:12 kristofrk

@kristofrk any specific details about your scenario? Are you apart of many tenants or do you have many subscriptions? Multiple accounts?

alexweininger avatar Dec 03 '25 19:12 alexweininger

I solved it. Apparently the extension was trying to use the wrong account for authenticating to Azure.

kristofrk avatar Dec 03 '25 19:12 kristofrk

@kristofrk glad to hear that. Do you think there's action items for the extension to handle this better?

alexweininger avatar Dec 04 '25 15:12 alexweininger

I should mention that this problem is still very much happening for me. However, I did just notice that https://github.com/microsoft/vscode-azuretools/issues/2101 was just closed, and https://github.com/microsoft/vscode-azuretools/pull/2119 seems to say it should fix this, so I'm hopeful that will work for me too whenever the fix is released.

Qythyx avatar Dec 04 '25 23:12 Qythyx

We expect https://github.com/microsoft/vscode-azuretools/issues/2101 should make a pretty big difference in the apparent performance. The first refresh will be parallelized, 3-5x faster (depending on the number of accounts and tenants), and subsequent automatic refreshes should be nearly instant due to caching. We are planning to make it so that manually clicking the refresh button on the views will empty and refill the cache, so those will be as fast as the first one (not near-instant).

bwateratmsft avatar Dec 05 '25 13:12 bwateratmsft