Agenda:
In this article, we will learn to create an SFTP enabled Azure BLOB Storage account and access the account container using private credentials with the help of SSH.NET library.
Pre-requisites:
1) .NET SDK (Any version)
2) Visual Studio Code
=> Download .NET SDK for Windows or Mac based on your operating system from https://dotnet.microsoft.com/en-us/download/visual-studio-sdks.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 1 Download .NET SDK for Windows](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/net-sdks-for-visual-studio-1-1024x394.jpg)
=> Download Visual Studio code from Microsoft’s official website https://code.visualstudio.com/Download
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 2 Download Visual Studio code from Microsoft’s](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/download-visual-studio-code-1024x480.jpg)
READ – Exploring the Future of Azure Data Lake: Trends & Innovations
Once you install .NET SDK, type the below command and you should see the result like below. If the result is something different, then there might be some issue with .NET installation.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 3 type the below command](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/dotnet-info-1024x317.png)
Once you install VS Code, just type “code”. In the terminal, and it should open Visual Studio Code GUI.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 4 Once you install VS Code, just type “code”](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/Visual-Studio-Code-1024x551.jpg)
=> Creating an SFTP enabled Azure BLOB Storage
To smooth out data management and analytics, create a resource group that incorporates Azure Synapse Analytics for seamless Azure data factory integration runtime and proficient handling of large datasets.
Step 1: Create a Resource Group
=> On the home page of the Azure portal, you should see a tile with name Resource Group. If not, you can search it on the top search bar.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 5 Resource Group](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/azure-resource-1024x809.jpg)
=> Click Create button in the Resource Groups popup, and you should see the below screen.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 6 Resource Groups popup](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/create-a-resource-group-1024x594.jpg)
=> Enter the Resource group name and select a region as mentioned above.
=> Click Review+Create button and you will see the below screen where Azure validates the data entered by you.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 7 Click Review+Create button](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/Review-create-button-1024x786.jpg)
=> Finally click create button to create the resource group named “demo-rg”.
Step 2: Creating Storage Account for File Storage
=> Go inside the resource group and click create button.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 8 Creating Storage Account for File Storage](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/demo-rg-1024x195.jpg)
=> Search for Storage Account and click Create button.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 9 Search for Storage Account](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/storage-account.jpg)
=> Once you click Create button, you will see Storage Account configuration wizard. Select the values as mentioned in the screenshots below.
READ – Essential 12+ Azure Data Factory Tools for Data Integration
Basics Tab:
=> The most important thing on this page is to select Primary Service as Azure Data Lake Analytics Gen 2.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 10 Primary Service as Azure Data Lake Analytics](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/storage-account-basics-tab-973x1024.jpg)
Advanced Tab:
=> To enable SFTP features, you need to first select Enable Hierarchical namespace.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 11 SFTP features](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/storage-account-advanced-tab-722x1024.jpg)
Networking Tab:
=> Keep everything same on this tab.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 12 Networking Tab:](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/storage-account-networking-tab-831x1024.jpg)
Data Protection Tab:
=> Keep everything same here as well.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 13 Data Protection Tab](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/storage-account-data-protection-tab-780x1024.jpg)
Encryption Tab:
=> Keep everything same here as well.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 14 Encryption Tab](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/storage-account-encryption-tab-1024x460.jpg)
=> Press Review + Create and you should see below screen. Verify all the details and click Create button to create the storage account.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 15 Press Review + Create](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/storage-account-review-create-tab-495x1024.jpg)
READ – AI & Analytics: Azure Data Lake as Your Innovation Platform
Step 3: Configure Private User Credentials and Create Container
=> Configure private user credentials and create container in storage account.
=> Go inside the created storage account, and on the left navigation panel, expand Settings and you will find SFTP option there.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 16 Configure Private User Credentials and Create Container](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/demostgsftp-414x1024.jpg)
=> Click Add local user.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 17 Add local user](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/add-local-user-1024x193.jpg)
=> In the user + authentication tab, configure the following.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 18 authentication tab](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/add-local-user-authentication-1024x414.jpg)
=> Create a new container and mention the same container name in Landing directory.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 19 new container and mention the same container name](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/add-local-user-permission-1024x713.jpg)
=> Select all permissions for the container.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 20 permissions for the container](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/add-local-user-permission-container-1024x668.jpg)
=> Once you click Add button, you will see a popup showing the SSH password. Copy and keep it somewhere handy. We will use this password when we connect to this container with .NET development services.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 21 SSH password.](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/ssh-password-1024x509.jpg)
=> Finally you will see all container details with user details like below in SFTP enabled Azure BLOB Storage page.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 22 container details](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/container-details-1024x82.jpg)
Step 4: Add some Sample Files inside the Container Folder
=> Go to the containers option like below and you should see the container that we created in the previous step.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 23 Sample Files inside the Container Folder](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/demost-containers-1024x291.jpg)
=> Click on the container name and click Upload button. Once you click Upload button, you can upload any sample files which you want using the dialog box with Browse for file option.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 24 dialog box with Browse for file option](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/demo-containers-1024x150.jpg)
=> I have uploaded 12 files like below.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 25 uploaded 12 files like below](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/demo-containers-files-1024x348.jpg)
Step 5: Creating .NET Console App
=> Creating .NET console app and access the above container with the app using the private credentials.
=> Go to the terminal and open a folder inside it. Then use the following command to create the .NET console app using .NET CLI.
dotnet new console -lang “C#”
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 26 Creating .NET Console App](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/dotnet-new-console-1024x287.jpg)
=> The Nuget package that we are using is SSH.NET. You can install the package using the following command.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 27 Nuget package](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/Nuget-package-1024x342.jpg)
=> Once the package is installed, open the project in VS Code. You can see the package reference in .csproj file.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 28 project in VS Code](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/sftp-demo-csproj-1024x595.jpg)
=> Open Program.cs file and use write the code shown below.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 29 Open Program.cs file](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/sftp-demo-program-1024x296.jpg)
=> The above is very simple and self-explanatory. We are just creating a SFTP client object and passing hostname, username and password.
=> Client object connects to the SFTP enabled Azure BLOB Storage container and lists all the files inside the home directory.
READ – Data Factory in Microsoft Fabric: Features and Benefits
=> Run the program using F5 button, you should see the following output in the output window. In the output, you can see the files that we uploaded in the Azure container.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 30 Run the program using F5 button](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/sftp-run-program-1024x531.jpg)
=> SSH.NET is a powerful library and you can use it for many features. Below is a screenshot from its official website. You can explore more on it.
![Read/Write Files from a SFTP Enabled Azure BLOB Storage Container 31 SSH.NET is a powerful library](https://www.aegissofttech.com/insights/wp-content/uploads/2025/01/ssh-net-powerful-library-1024x654.jpg)