Fixing Kudu Console Item Limit in Azure: A Simple Solution

Fixing Kudu Console Item Limit in Azure: A Simple Solution

By admin January 21, 2024

While working with Sitecore Managed Cloud, I needed to check if all Unicorn items were deployed correctly. However, I ran into an issue where Kudu displayed an error:

"The number of items is too large to be displayed."

This occurred because the number of items in the directory was too large for Kudu's default view limit. If you've encountered a similar issue when trying to verify large numbers of items, such as Unicorn serialized items or large content folders, there’s a quick fix to increase the item limit in Kudu.

Here’s how you can resolve it and view all the items in your directories.

The Issue: Kudu's Display Limit

By default, the Kudu console is configured to limit the number of items it displays in the browser. When you try to view directories with many files (more than a few hundred, for example), it hits this display limit and stops rendering additional items.

The default setting often caps the view at around 300-500 items. If you're working with directories containing many more files (e.g., Unicorn items, logs, or large media directories), this limit can block your ability to fully inspect the contents.

The Solution: Increase the Max Viewable Items

Thankfully, there’s a simple fix for this issue: increase the number of items Kudu can display in the browser. We can do this using the browser’s developer tools by adjusting a setting in the local storage for Kudu.

Here’s how you can do it:

Step-by-Step Guide to Fixing the Kudu Item Limit

  1. Open Kudu for Your App Service
    • Navigate to your Azure portal and go to your App Service.
    • Under the "Development Tools" section in the left-hand menu, click on Advanced Tools and then select Go. This will open the Kudu interface.
  2. Access the Kudu Console
    • In the Kudu interface, click on the Debug Console tab.
    • From here, you can access either the CMD or PowerShell debug console to browse files and execute commands.
  3. Open the Browser Developer Tools
    • Once in the Kudu console, press F12 (or Ctrl + Shift + I on Windows, or Cmd + Option + I on Mac) to open your browser’s developer tools.
    • Navigate to the Console tab within the developer tools.
  4. Increase the Maximum Viewable Items
    • In the console, run the following command to increase the number of items Kudu can display:
window.localStorage['maxViewItems'] = 1000;
  • This command sets the maximum number of items that Kudu can display to 1000. If you have more than 1000 items in a directory, you can increase this number even further by adjusting the value.
  • Refresh the Kudu Console
    • After running the command, refresh the Kudu page or the directory listing to apply the new setting.
    • You should now be able to view up to 1000 items (or more if you set a higher value) in the directory.

Why Does This Work?

Kudu’s item display limit is stored in the browser’s local storage, which is why we can manipulate it using JavaScript via the developer tools. By manually increasing the maxViewItems property, we override the default display limit and allow the Kudu interface to render more items at once.

When to Use This Fix

This fix is helpful in the following scenarios:

  • Unicorn deployments: When verifying the deployment of serialized items in Sitecore (via Unicorn), you may need to inspect hundreds or thousands of items to ensure they were correctly synced.
  • Log directories: If your app generates many log files, you might need to browse through hundreds or thousands of them.
  • Media directories: Large numbers of uploaded files, images, or assets can easily exceed Kudu’s default limit.
  • Temp directories: Temporary files and caches can quickly accumulate, especially after numerous deployments or builds.

Important Notes

  • Performance: Increasing the item limit can impact performance when browsing large directories. If you increase the limit too high (e.g., 10,000 items), the Kudu interface may slow down or become unresponsive.
  • Persistence: The change to maxViewItems is stored in your browser's local storage, so it will persist across sessions as long as you use the same browser. However, if you clear your browser's cache or use a different machine, you will need to reapply this fix.

Conclusion

Kudu is an essential tool for Azure App Service management, but its default file display limit can be restrictive when working with large directories. By simply adjusting the maxViewItems setting in the browser’s local storage, you can bypass this limitation and view up to 1000 or more items.

This quick and easy fix will save you time and effort when managing your app’s file system in Kudu, especially when working with large Sitecore Unicorn deployments. Keep this tip handy for future debugging sessions!

Featured Blogs