Enumerate Azure Storage File Share files with the .NET Azure SDK

This is a quick one. I recently had to enumerate an Azure Storage File Share with unknown files and directories so I quickly put together this .NET Core Console solution using the latest .NET Azure SDK. You can find more info on the latest and coolest Azure SDKs here.

Kudos to Jon Gallant (Azure SDKs team) for pointing me to the right/latest Azure SDK. It made my life so much easier and the code is more than half than the previous version.

Start by creating a new console app and adding the Azure.Storage.Files.Shares NuGet package. Open the command line, navigate to your usual project folder and type the following:

mkdir azureDemo && cd azureDemo
dotnet new console

Wait for the project to be created and then add the necessary NuGet package:

dotnet add package Azure.Storage.Files.Shares

Once the package is restored, open Visual Studio or Visual Studio Code and add the following code:

You will need to add the appropriate references as per the gist sample (VS or VS Code IntelliSense should prompt you for these anyway):

using Azure.Storage.Files.Shares;
using Azure.Storage.Files.Shares.Models;
using System.Collections.Generic;

Finally, you'll need to make sure to update the inline connection string with your storage account name and the SAS Uri which should look like this:


That's all for today....

  • Share this post on