### Example output of the quickstart app Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Example output of the app after running `node index.js`. It shows the sequence of operations: creating a container, uploading a blob, listing blobs, downloading blob content, and deleting the container. ```Output Azure Blob storage - JavaScript quickstart sample Creating container... quickstart4a0780c0-fb72-11e9-b7b9-b387d3c488da Uploading to Azure Storage as blob: quickstart4a3128d0-fb72-11e9-b7b9-b387d3c488da.txt Listing blobs... quickstart4a3128d0-fb72-11e9-b7b9-b387d3c488da.txt Downloaded blob content... Hello, World! Deleting container... Done ``` -------------------------------- ### Install packages for Azure Blob Storage quickstart Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Installs the Azure Blob Storage and Azure Identity client libraries, along with uuid and dotenv, for the quickstart project. Run this in the local blob-quickstart directory before updating the storage account name in index.js. ```console npm install @azure/storage-blob @azure/identity uuid dotenv ``` -------------------------------- ### Install other dependencies Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Installs uuid and dotenv packages used in the quickstart. ```bash npm install uuid dotenv ``` -------------------------------- ### Run the Azure Blob Storage quickstart app Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Runs the sample console app after installing packages and updating the storage account name in index.js. The app creates a container, uploads a text string as a blob, lists the blobs, downloads and displays the blob contents, then deletes the container and all its blobs. ```console node index.js ``` -------------------------------- ### Start the web app with npm start Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Run this command in a Visual Studio Code terminal to bundle the files and start the web server. ```console npm start ``` -------------------------------- ### Install BlobFuse2 on Ubuntu using wget and apt Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-install For Ubuntu distributions, run these commands to add the Microsoft repository and install BlobFuse2. Replace the placeholder with your Ubuntu version (for example: 20.04 or 22.04). ```bash sudo wget https://packages.microsoft.com/config/ubuntu//packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb sudo apt-get update sudo apt-get install fuse3 blobfuse2 ``` -------------------------------- ### Install Azure.Identity and Azure.Storage.Blobs packages Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-change-feed-how-to Install the Azure Identity and Azure Blob Storage packages required for the code examples in this article. ```console dotnet add package Azure.Identity dotnet add package Azure.Storage.Blobs ``` -------------------------------- ### Install AZNFS Mount Helper Source: https://learn.microsoft.com/en-us/azure/storage/blobs/network-file-system-protocol-support-how-to Run this command to download and execute the installation script for the AZNFS Mount Helper package if it is not already installed. ```bash wget -O - -q https://github.com/Azure/AZNFS-mount/releases/latest/download/aznfs_install.sh | bash ``` -------------------------------- ### Install Az.Storage preview module Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blob-storage-advanced-platform-metrics Installs the Az.Storage preview module version 9.6.3-preview with admin privileges. Requires PowerShellGet to be installed first. ```powershell Install-Module Az.Storage -Repository PsGallery -RequiredVersion 9.6.3-preview -AllowClobber -AllowPrerelease -Force ``` -------------------------------- ### Run the Python application Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python Execute the quickstart script from the directory containing blob_quickstart.py. ```bash python blob_quickstart.py ``` -------------------------------- ### Replace Program.cs with using statements and Hello World in C# Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet Replace the starting code in Program.cs with this example, which includes the necessary using statements for the exercise. The code prints "Hello, World!" to the console. ```csharp using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; using System; using System.IO; // See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!"); ``` -------------------------------- ### Sample application output Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-c-plus-plus The expected console output after running the quickstart application. ```text Azure Blob Storage - C++ quickstart sample Creating container: myblobcontainer Uploading blob: blob.txt Listing blobs... Blob name: blob.txt Downloaded blob contents: Hello Azure! Deleting blob: blob.txt Deleting container: myblobcontainer ``` -------------------------------- ### Install Azure.Storage.Blobs.ChangeFeed package Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-change-feed-how-to Use the dotnet add package command to install the Azure.Storage.Blobs.ChangeFeed package with the --prerelease flag to get the latest preview version. ```console dotnet add package Azure.Storage.Blobs.ChangeFeed --prerelease ``` -------------------------------- ### Install Azure Storage package Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs-typescript Install the @azure/storage-blob package. ```bash npm install @azure/storage-blob ``` -------------------------------- ### Install @azure/storage-file-datalake Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-directory-file-acl-javascript Install the Data Lake client library for JavaScript using npm. ```bash npm install @azure/storage-file-datalake ``` -------------------------------- ### List blobs with prefix output example Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-list-go Example console output when filtering blobs by the prefix 'sample'. ```text List blobs with prefix: sample-blob1.txt sample-blob2.txt sample-blob3.txt ``` -------------------------------- ### Usage example for external blob copy Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-copy-async-go Example showing how to define the source URL and destination client before calling the copy function. ```go externalURL := "" destBlob = destClient.ServiceClient().NewContainerClient("destination-container").NewBlockBlobClient("destination-blob-2") copyFromExternalSourceAsync(externalURL, destBlob) ``` -------------------------------- ### Install PowerShellGet Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blob-storage-advanced-platform-metrics Installs the latest PowerShellGet module from PSGallery, required before installing the Az.Storage preview module. ```powershell Install-Module PowerShellGet -Repository PSGallery -Force ``` -------------------------------- ### Expected application output Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-go Example output showing the creation, upload, listing, and cleanup process of the sample application. ```text Azure Blob storage quick start sample Creating a container named quickstart-sample-container Uploading a blob named sample-blob Listing the blobs in the container: sample-blob Blob contents: Hello, world! This is a blob. Press enter key to delete resources and exit the application. Cleaning up. Deleting the blob sample-blob Deleting the container quickstart-sample-container ``` -------------------------------- ### Install azblob module Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-container-delete-go Command to install the Azure Blob Storage client module for Go. ```console go get github.com/Azure/azure-sdk-for-go/sdk/storage/azblob ``` -------------------------------- ### Add start script to package.json Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Adds a 'start' script to bundle the website using Parcel. ```json "scripts": { "start": "parcel ./index.html" }, ``` -------------------------------- ### Install Python packages Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-query-endpoint-srp Use pip to install the required Azure Identity, Storage Blob, and Management packages. ```bash pip install azure-identity pip install azure-storage-blob pip install azure-mgmt-resource pip install azure-mgmt-storage ``` -------------------------------- ### Example output of mounting all containers Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-commands-mount Shows the output when mounting all containers. ```output Mounting container : blobfuse2a to path : bf2all/blobfuse2a Mounting container : blobfuse2b to path : bf2all/blobfuse2b ``` -------------------------------- ### Install dependencies from requirements.txt Source: https://learn.microsoft.com/en-us/azure/storage/blobs/use-azurite-to-run-automated-tests Installs the Python packages listed in a requirements.txt file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install BlobFuse on Ubuntu Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux Install the BlobFuse package on Ubuntu distributions using apt-get. ```bash sudo apt-get install blobfuse ``` -------------------------------- ### Install Azure client libraries via .NET CLI Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-encrypt-decrypt-blobs-key-vault Install the required Azure Identity, Key Vault Keys, and Storage Blobs packages using the .NET CLI. ```bash dotnet add package Azure.Identity dotnet add package Azure.Security.KeyVault.Keys dotnet add package Azure.Storage.Blobs ``` -------------------------------- ### List blobs flat output example Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-list-go Example console output for a flat blob listing. ```text List blobs flat: file4.txt folderA/file1.txt folderA/file2.txt folderA/folderB/file3.txt ``` -------------------------------- ### Install Azure Storage npm package Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Installs the Azure Storage client library for JavaScript from npm. ```bash npm install @azure/storage-blob ``` -------------------------------- ### Install BlobFuse2 zsh completions for new sessions (Linux and macOS) Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-commands-completion-zsh Installs BlobFuse2 zsh completions permanently for every new shell session. The first command is for Linux, the second for macOS. A new shell must be started for the setup to take effect. ```shell blobfuse2 completion zsh > "${fpath[1]}/_blobfuse2" ``` ```shell blobfuse2 completion zsh > /usr/local/share/zsh/site-functions/_blobfuse2 ``` -------------------------------- ### Install JavaScript packages Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-query-endpoint-srp Use npm to install the required Azure Identity, Storage Blob, and Resource Manager packages. ```bash npm install @azure/identity npm install @azure/storage-blob npm install @azure/arm-resources npm install @azure/arm-storage ``` -------------------------------- ### Run the Go application Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-go Command to execute the storage-quickstart.go application. ```bash go run storage-quickstart.go ``` -------------------------------- ### Add import paths for azblob and azidentity Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-container-create-go Add the required import paths for the Azure Blob Storage and Azure Identity modules. These are the minimum imports needed to get started; some examples may require additional imports. ```go import ( "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob" ) ``` -------------------------------- ### Install azblob and azidentity modules Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-container-create-go Install the azblob module for Azure Blob Storage and the azidentity module for Microsoft Entra ID authentication. Run these commands in your Go project directory before adding import paths. ```console go get github.com/Azure/azure-sdk-for-go/sdk/storage/azblob ``` ```console go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` -------------------------------- ### Install azidentity module Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-container-delete-go Command to install the azidentity module for Microsoft Entra ID authentication. ```console go get github.com/Azure/azure-sdk-for-go/sdk/azidentity ``` -------------------------------- ### Create a container Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-go Creates a new container named quickstart-sample-container in the storage account. ```go // Create the container containerName := "quickstart-sample-container" fmt.Printf("Creating a container named %s\n", containerName) _, err = client.CreateContainer(ctx, containerName, nil) handleError(err) ``` -------------------------------- ### Initialize azd template Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-java Command to clone the quickstart repository and initialize the template locally. ```console azd init --template blob-storage-quickstart-java ``` -------------------------------- ### Example application output Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-java Sample console output showing the upload, listing, download, and cleanup process. ```text Azure Blob Storage - Java quickstart sample Uploading to Blob storage as blob: https://mystorageacct.blob.core.windows.net/quickstartblobsUUID/quickstartUUID.txt Listing blobs... quickstartUUID.txt Downloading blob to ./data/quickstartUUIDDOWNLOAD.txt Press the Enter key to begin clean up Deleting blob container... Deleting the local source and downloaded files... Done ``` -------------------------------- ### Create application structure Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python Basic structure for the blob_quickstart.py file including necessary imports and exception handling. ```Python import os, uuid from azure.identity import DefaultAzureCredential from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient try: print("Azure Blob Storage Python quickstart sample") # Quickstart code goes here except Exception as ex: print('Exception:') print(ex) ``` -------------------------------- ### Check Azure CLI version Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-acl-cli Verifies that the installed Azure CLI version is 2.14.0 or higher, which is required for the commands in this guide. ```azure cli az --version ``` -------------------------------- ### Example output of mount list Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-commands-mount Shows the output of the mount list command. ```output 1 : /home//bf2a ``` -------------------------------- ### Install Azure Identity C++ library with vcpkg Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-c-plus-plus Installs the Azure Identity library, required for passwordless connections to Azure services. ```console vcpkg.exe install azure-identity-cpp ``` -------------------------------- ### Archive a blob using az storage blob copy start Source: https://learn.microsoft.com/en-us/azure/storage/blobs/archive-blob Use the az storage blob copy start command in Azure CLI to copy a blob to the archive tier. This example uses Microsoft Entra ID for authorization via the --auth-mode login flag. ```bash az storage blob copy start \ --source-container \ --source-blob \ --destination-container \ --destination-blob \ --account-name \ --tier Archive \ --auth-mode login ``` -------------------------------- ### Install Azure Storage Blob packages Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-container-create-python Use pip to install the necessary Azure Storage Blob and Identity libraries. ```bash pip install azure-storage-blob azure-identity ``` -------------------------------- ### Install Azure Storage packages via .NET CLI Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-user-delegation-sas-create-dotnet Use the .NET CLI to install the required Azure Identity and Storage Blobs packages. ```bash dotnet add package Azure.Identity dotnet add package Azure.Storage.Blobs ``` -------------------------------- ### Clone the sample application repository Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-go Clones the sample application repository to your local git folder. The sample file is named storage-quickstart.go. ```console git clone https://github.com/Azure-Samples/storage-blobs-go-quickstart ``` -------------------------------- ### Get container and blob URLs in TypeScript Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-get-url-javascript This example shows how to retrieve URLs for containers and blobs using TypeScript, including explicit type definitions for responses and clients. ```typescript async function getUrls(blobServiceClient: BlobServiceClient): Promise { // create container const containerName = `con1-${Date.now()}`; const { containerClient, containerCreateResponse }: { containerClient: ContainerClient; containerCreateResponse: ContainerCreateResponse; } = await blobServiceClient.createContainer(containerName, { access: 'container' }); if (containerCreateResponse.errorCode) throw Error(containerCreateResponse.errorCode); // Display container name and its URL console.log( `created container:\n\tname=${containerClient.containerName}\n\turl=${containerClient.url}` ); // create blob from string const blobName = `${containerName}-from-string.txt`; const blobContent = `Hello from a string`; const blockBlobClient = await containerClient.getBlockBlobClient(blobName); const blockBlobUploadResponse: BlockBlobUploadResponse = await blockBlobClient.upload(blobContent, blobContent.length); if (blockBlobUploadResponse.errorCode) throw Error(blockBlobUploadResponse.errorCode); // Display Blob name and its URL console.log( `created blob:\n\tname=${blobName}\n\turl=${blockBlobClient.url}` ); // In loops, blob is BlobItem // Use BlobItem.name to get BlobClient or BlockBlobClient // The get `url` property for await (const blob of containerClient.listBlobsFlat({ includeMetadata: true, includeSnapshots: false, includeTags: true, includeVersions: false, prefix: '' })) { // blob console.log('\t', blob.name); // Get Blob Client from name, to get the URL const tempBlockBlobClient: BlockBlobClient = containerClient.getBlockBlobClient(blob.name); // Display blob name and URL console.log(`\t${blob.name}:\n\t\t${tempBlockBlobClient.url}`); } } ``` -------------------------------- ### Install Azure client libraries via PowerShell Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-encrypt-decrypt-blobs-key-vault Install the required Azure Identity, Key Vault Keys, and Storage Blobs packages using PowerShell. ```powershell Install-Package Azure.Identity Install-Package Azure.Security.KeyVault.Keys Install-Package Azure.Storage.Blobs ``` -------------------------------- ### Get container and blob URLs in JavaScript Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-get-url-javascript This example demonstrates creating a container and a blob, then accessing their 'url' properties. It also shows how to iterate through blobs in a container to retrieve each blob's URL. ```javascript // create container const containerName = `con1-${Date.now()}`; const { containerClient } = await blobServiceClient.createContainer(containerName, {access: 'container'}); // Display container name and its URL console.log(`created container:\n\tname=${containerClient.containerName}\n\turl=${containerClient.url}`); // create blob from string const blobName = `${containerName}-from-string.txt`; const blobContent = `Hello from a string`; const blockBlobClient = await containerClient.getBlockBlobClient(blobName); await blockBlobClient.upload(blobContent, blobContent.length); // Display Blob name and its URL console.log(`created blob:\n\tname=${blobName}\n\turl=${blockBlobClient.url}`); // In loops, blob is BlobItem // Use BlobItem.name to get BlobClient or BlockBlobClient // The get `url` property for await (const blob of containerClient.listBlobsFlat()) { // blob console.log("\t", blob.name); // Get Blob Client from name, to get the URL const tempBlockBlobClient = containerClient.getBlockBlobClient(blob.name); // Display blob name and URL console.log(`\t${blob.name}:\n\t\t${tempBlockBlobClient.url}`); } ``` -------------------------------- ### Initialize Azure Developer CLI template Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python Clone the quickstart repository assets and initialize the template locally. ```Console azd init --template blob-storage-quickstart-python ``` -------------------------------- ### Install and run Azurite locally using npm Source: https://learn.microsoft.com/en-us/azure/storage/blobs/use-azurite-to-run-automated-tests Use npm to install Azurite globally, create a directory for Azurite data, and launch it with the specified flags. The --silent flag suppresses output, --location specifies the data directory, and --debug writes logs to the given file. ```bash # Install Azurite npm install -g azurite # Create an Azurite directory mkdir c:\azurite # Launch Azurite locally azurite --silent --location c:\azurite --debug c:\azurite\debug.log ``` -------------------------------- ### Copy a blob from an external source using SyncUploadFromUriAsync Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-copy-url-dotnet This example shows how to copy a blob from an external URL accessible via HTTP GET. The source location is provided as a string and converted to a URI. ```csharp //------------------------------------------------- // Copy a blob from an external source //------------------------------------------------- public static async Task CopyFromExternalSourceAsync( string sourceLocation, BlockBlobClient destinationBlob) { Uri sourceUri = new(sourceLocation); // Create the destination blob from the source URL // overwrite param defaults to false await destinationBlob.SyncUploadFromUriAsync(sourceUri/*, overwrite: false*/); } ``` -------------------------------- ### Install Azure.Identity package Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-customer-provided-key Installs the latest version of the Azure.Identity client library for .NET, used to authenticate with Microsoft Entra credentials. ```powershell Install-Package Azure.Identity ``` -------------------------------- ### Install TypeScript and Azure packages (TypeScript) Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-javascript-get-started Install TypeScript along with the Azure Blob Storage and Azure Identity client libraries for a TypeScript project. ```bash npm install typescript @azure/storage-blob @azure/identity ``` -------------------------------- ### Create project directory Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Creates a new directory named 'blob-quickstart-v12' for the project. ```bash mkdir blob-quickstart-v12 ``` -------------------------------- ### Create BlobServiceClient in Python using an endpoint-retrieval sample Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-query-endpoint-srp Uses an example BlobEndpointSample and its get_blob_service_endpoint method to get the storage account endpoint, then constructs a BlobServiceClient with that endpoint and DefaultAzureCredential. Replace with the actual account name. Requires the Azure Blob SDK. ```python storage_account_name = "" credential = DefaultAzureCredential() sample = BlobEndpointSample() # Call out to our function that retrieves the blob service endpoint for a storage account endpoint = sample.get_blob_service_endpoint(storage_account_name, credential) print(f"URL: {endpoint}") # Now that we know the endpoint, create the client object blob_service_client = BlobServiceClient(account_url=endpoint, credential=credential) # Do something with the storage account or its resources ... ``` -------------------------------- ### Get blob tags with GetTags in Go Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-tags-go Retrieves and iterates over the blob's index tags using the GetTags method. Requires authorized access via RBAC role, SAS with 't' permission, or account key. The example prints each tag key and value. ```Go func getBlobTags(client *azblob.Client, containerName string, blobName string) { // Reference the blob as a client object blobClient := client.ServiceClient().NewContainerClient(containerName).NewBlobClient(blobName) // Get the blob tags resp, err := blobClient.GetTags(context.TODO(), nil) handleError(err) // Print the blob tags for _, v := range resp.BlobTags.BlobTagSet { fmt.Printf("Key: %v, Value: %v\n", *v.Key, *v.Value) } } ``` -------------------------------- ### Set up app framework (index.js) Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Creates the main application file with the BlobServiceClient, uuid, and dotenv imports, and a main function that logs a message and catches errors. ```javascript const { BlobServiceClient } = require("@azure/storage-blob"); const { v1: uuidv1 } = require("uuid"); require("dotenv").config(); async function main() { try { console.log("Azure Blob storage v12 - JavaScript quickstart sample"); // Quick start code goes here } catch (err) { console.err(`Error: ${err.message}`); } } main() .then(() => console.log("Done")) .catch((ex) => console.log(ex.message)); ``` -------------------------------- ### Create a container asynchronously with BlobServiceClient (C#) Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-container-create Use this C# example to create a container asynchronously with a BlobServiceClient. It generates a unique container name using a GUID, calls CreateBlobContainerAsync, and checks existence before returning the client. The method catches RequestFailedException and prints HTTP error details if creation fails. ```csharp //------------------------------------------------- // Create a container //------------------------------------------------- private static async Task CreateSampleContainerAsync(BlobServiceClient blobServiceClient) { // Name the sample container based on new GUID to ensure uniqueness. // The container name must be lowercase. string containerName = "container-" + Guid.NewGuid(); try { // Create the container BlobContainerClient container = await blobServiceClient.CreateBlobContainerAsync(containerName); if (await container.ExistsAsync()) { Console.WriteLine("Created container {0}", container.Name); return container; } } catch (RequestFailedException e) { Console.WriteLine("HTTP error code {0}: {1}", e.Status, e.ErrorCode); Console.WriteLine(e.Message); } return null; } ``` -------------------------------- ### Change to project directory Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Switches the current directory to the newly created 'blob-quickstart' directory. ```bash cd blob-quickstart ``` -------------------------------- ### Create project directory Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Creates a new directory named 'blob-quickstart' for the Node.js project. ```bash mkdir blob-quickstart ``` -------------------------------- ### Install Azure PowerShell Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-user-delegation-sas-create-powershell Installs the latest version of Azure PowerShell from the PSGallery repository. Requires PowerShellGet to be installed first. ```powershell Install-Module Az -Repository PSGallery -AllowClobber ``` -------------------------------- ### Create and open the BlobQuickstart console app with .NET CLI Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet Use the .NET CLI to create a new console app named BlobQuickstart, switch to its directory, and open it in Visual Studio Code. The first command creates a simple "Hello World" C# project with a single source file Program.cs. ```bash dotnet new console -n BlobQuickstart ``` ```bash cd BlobQuickstart ``` ```bash code . ``` -------------------------------- ### Download helper scripts and set up edge node Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-migrate-on-premises-hdfs-cluster Run these commands on the edge or head node of the on-premises Hadoop cluster to clone the helper scripts repository, install the jq package, install the Requests Python package, and set execute permissions on the required scripts. ```Bash git clone https://github.com/jamesbak/databox-adls-loader.git cd databox-adls-loader ``` ```Bash sudo apt-get install jq ``` ```Bash pip install requests ``` ```Bash chmod +x *.py *.sh ``` -------------------------------- ### Install Az.Storage module and check PowerShell version Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-acl-powershell Verifies that PowerShell 5.1 or higher is installed, then installs the Az.Storage module from the PowerShell Gallery. Run the version check first; upgrade PowerShell if needed before installing the module. ```powershell echo $PSVersionTable.PSVersion.ToString() ``` ```powershell Install-Module Az.Storage -Repository PSGallery -Force ``` -------------------------------- ### Initialize package.json Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs-typescript Create a package.json file for the project. ```bash npm init -y ``` -------------------------------- ### Start upgrade with Invoke-AzStorageAccountHierarchicalNamespaceUpgrade Source: https://learn.microsoft.com/en-us/azure/storage/blobs/upgrade-to-data-lake-storage-gen2-how-to Starts the upgrade to Azure Data Lake Gen2. Replace placeholders with your resource group and storage account names. The -AsJob switch runs the command in a background job so your client isn't blocked. ```powershell $result = Invoke-AzStorageAccountHierarchicalNamespaceUpgrade -ResourceGroupName "" -Name "" -RequestType Upgrade -AsJob -Force ``` -------------------------------- ### Acquire a container lease Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-container-lease-java This example demonstrates how to create a BlobLeaseClient and acquire a 30-second lease on a container. ```java public BlobLeaseClient acquireContainerLease(BlobContainerClient container) { // Create the lease client BlobLeaseClient leaseClient = new BlobLeaseClientBuilder() .containerClient(container) .buildClient(); // Acquire the lease - specify duration between 15 and 60 seconds, or -1 for // infinite duration String leaseID = leaseClient.acquireLease(30); System.out.printf("Acquired lease ID: %s%n", leaseID); return leaseClient; } ``` -------------------------------- ### Upload blob with customer-provided key (C#) Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-customer-provided-key This C# example uploads a blob using a customer-provided AES-256 key. It creates a CustomerProvidedKey, verifies its encryption hash, and configures the BlobClientOptions with the key. The example uses DefaultAzureCredential for authorization and creates the container if it does not exist. ```C# async static Task UploadBlobWithClientKey(Uri blobUri, Stream data, byte[] key, string keySha256) { // Create a new customer-provided key. // Key must be AES-256. var cpk = new CustomerProvidedKey(key); // Check the key's encryption hash. if (cpk.EncryptionKeyHash != keySha256) { throw new InvalidOperationException("The encryption key is corrupted."); } // Specify the customer-provided key on the options for the client. BlobClientOptions options = new BlobClientOptions() { CustomerProvidedKey = cpk }; // Create the client object with options specified. BlobClient blobClient = new BlobClient( blobUri, new DefaultAzureCredential(), options); // If the container may not exist yet, // create a client object for the container. // The container client retains the credential and client options. BlobContainerClient containerClient = blobClient.GetParentBlobContainerClient(); try { // Create the container if it does not exist. await containerClient.CreateIfNotExistsAsync(); // Upload the data using the customer-provided key. await blobClient.UploadAsync(data); } catch (RequestFailedException e) { Console.WriteLine(e.Message); Console.ReadLine(); throw; } } ``` -------------------------------- ### Install async transport for Azure Blob Storage Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-python-get-started Install aiohttp along with azure-storage-blob using the optional dependency install command to support asynchronous APIs. ```console pip install azure-storage-blob[aio] ``` -------------------------------- ### Change to project directory Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Switches the current directory to the newly created 'blob-quickstart-v12' directory. ```bash cd blob-quickstart-v12 ``` -------------------------------- ### Install Azure.Storage.Blobs package and fix package source with .NET CLI Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet Install the Azure.Storage.Blobs package with the .NET CLI. If the add command fails, list the package sources with dotnet nuget list source and, if nuget.org is missing, add it with dotnet nuget add source. ```bash dotnet add package Azure.Storage.Blobs ``` ```bash dotnet nuget list source ``` ```bash dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org ``` -------------------------------- ### index.html - Hello World page Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website-host Create the default index file for the static website. Save this content as index.html in the mywebsite folder before deploying. ```html

Hello World!

``` -------------------------------- ### Install Az.Storage Module Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-user-delegation-sas-create-powershell Installs the latest version of the Az.Storage module, which is required to create a user delegation SAS. Ensure Azure PowerShell version 3.2.0 or later is installed. ```powershell Install-Module -Name Az.Storage -Repository PSGallery -Force ``` -------------------------------- ### Initialize, authenticate, and deploy with Azure Developer CLI Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet Initialize the Azure Developer CLI template for the blob storage quickstart, log in to Azure, and provision/deploy resources. The azd up command prompts for subscription and location, and its output includes the name of the newly created storage account needed later to run the code. ```bash azd init --template blob-storage-quickstart-dotnet ``` ```bash azd auth login ``` ```bash azd up ``` -------------------------------- ### Sample output for flat listing Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-list-javascript Sample output from the flat listing example. Assumes a storage account with a flat namespace; with hierarchical namespace enabled, directories appear as zero-length blobs. ```console Blobs flat list (by page): - Page: - a1 - a2 - Page: - folder1/b1 - folder1/b2 - Page: - folder2/sub1/c - folder2/sub1/d ``` -------------------------------- ### Install Parcel bundler Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Installs the Parcel bundler to bundle files for the browser. ```bash npm install parcel ``` -------------------------------- ### Example output of mount list after mounting all Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-commands-mount Shows the output of the mount list command after mounting all containers. ```output 1 : /home//bf2all/blobfuse2a 2 : /home//bf2all/blobfuse2b ``` -------------------------------- ### Install Azure Data Lake Storage and Identity packages Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-acl-javascript Run these npm install commands to install the @azure/storage-file-datalake and @azure/identity packages. The @azure/identity package is required for passwordless connections to Azure services. ```bash npm install @azure/storage-file-datalake npm install @azure/identity ``` -------------------------------- ### Install .NET packages Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-query-endpoint-srp Use the .NET CLI to add the required Azure Identity, Resource Manager, and Storage Blob packages to your project. ```bash dotnet add package Azure.Identity dotnet add package Azure.ResourceManager.Storage dotnet add package Azure.Storage.Blobs ``` -------------------------------- ### Build the .NET application Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet Use the .NET CLI to build the application from the project directory. ```console dotnet build ``` -------------------------------- ### Generate a service SAS for a container with New-AzStorageContainerSASToken Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blob-containers-powershell Use the New-AzStorageContainerSASToken cmdlet to generate a service SAS for a container. The example sets start and expiry times, permissions (read, write, list), and the HttpsOnly protocol. It shows two approaches: generating a token for a single container and generating tokens for a container list via the pipeline. The SAS token returned does not include the '?' delimiter; append it when using the token in a URL. ```powershell # Create variables $accountName = "" $containerName = "individual-container" $startTime = Get-Date $expiryTime = $startTime.AddDays(7) $permissions = "rwl" $protocol = "HttpsOnly" # Create a context object using Azure AD credentials, retrieve container $ctx = New-AzStorageContext -StorageAccountName $accountName -UseConnectedAccount # Approach 1: Generate SAS token for a specific container $sas = New-AzStorageContainerSASToken ` -Context $ctx ` -Name $containerName ` -StartTime $startTime ` -ExpiryTime $expiryTime ` -Permission $permissions ` -Protocol $protocol # Approach 2: Generate SAS tokens for a container list using pipeline Get-AzStorageContainer -Container $filterName -Context $ctx | New-AzStorageContainerSASToken ` -Context $ctx ` -StartTime $startTime ` -ExpiryTime $expiryTime ` -Permission $permissions ` -Protocol $protocol | Write-Output ``` -------------------------------- ### Install BlobFuse on SLES Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux Install the BlobFuse package on SLES distributions using zypper. ```bash sudo zypper install blobfuse ``` -------------------------------- ### Navigate to project directory Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-javascript-get-started Navigate to your project folder before setting up the Azure Blob Storage client library for JavaScript. ```bash cd ``` -------------------------------- ### Install BlobFuse on RHEL Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux Install the BlobFuse package on RHEL distributions using yum. ```bash sudo yum install blobfuse ``` -------------------------------- ### Sample output Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-java-quarkus Example output from running the sample. UUID values are omitted for readability. The output shows the upload URL, listing, download path, and cleanup messages. ```output Uploading to Blob storage as blob: https://mystorageacct.blob.core.windows.net/quickstartblobsUUID/quickstartUUID.txt Listing blobs... quickstartUUID.txt Downloading blob to ./data/quickstartUUIDDOWNLOAD.txt Press the Enter key to begin clean up Deleting blob container... Deleting the local source and downloaded files... Done ``` -------------------------------- ### Install Azure Storage Data Lake and Identity packages Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-acl-dotnet Use the .NET CLI to add the required client libraries for Data Lake storage and passwordless authentication. ```bash dotnet add package Azure.Storage.Files.DataLake dotnet add package Azure.Identity ``` -------------------------------- ### Install Azure Identity npm package Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Installs the @azure/identity package for passwordless connections. ```bash npm install @azure/identity ``` -------------------------------- ### Install dependencies on Ubuntu Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-install Installs the FUSE 3 development dependencies for Ubuntu distributions. ```bash sudo apt-get install fuse3 libfuse3-dev ``` -------------------------------- ### Initialize npm package Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Creates a package.json file with default settings using npm init -y. ```bash npm init -y ``` -------------------------------- ### Get subscription ID with az account show Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-auth-abac-cli Get the ID of your Azure subscriptions. ```bash az account show ``` -------------------------------- ### Install additional dependencies Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs-typescript Install required dependencies including uuid, dotenv, and type definitions. ```bash npm install uuid dotenv @types/node @types/uuid ``` -------------------------------- ### Create a new .NET console application Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-encrypt-decrypt-blobs-key-vault Use the dotnet new command to initialize a new C# console project named BlobEncryptionKeyVault. ```bash dotnet new console -n BlobEncryptionKeyVault ``` -------------------------------- ### Install Az module (PowerShell) Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-query-acceleration-how-to Installs the Az module version 4.6.0 or higher from PSGallery. ```powershell Install-Module -Name Az -Repository PSGallery -Force ``` -------------------------------- ### Acquire a 30-second blob lease Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-lease-java This example demonstrates how to create a BlobLeaseClient and acquire a 30-second lease for a specified blob. ```java public BlobLeaseClient acquireBlobLease(BlobClient blob) { // Create the lease client BlobLeaseClient leaseClient = new BlobLeaseClientBuilder() .blobClient(blob) .buildClient(); // Acquire the lease - specify duration between 15 and 60 seconds, or -1 for // infinite duration String leaseID = leaseClient.acquireLease(30); System.out.printf("Acquired lease ID: %s%n", leaseID); return leaseClient; } ``` -------------------------------- ### Manage Azure Blob Storage containers and blobs Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-java-quarkus This example demonstrates creating a container, uploading a local file as a blob, listing blobs, and downloading a blob. It includes a cleanup step to delete the container and local files. ```java // Create a unique name for the container String containerName = "quickstartblobs" + java.util.UUID.randomUUID(); // Create the container and return a container client object BlobContainerClient blobContainerClient = blobServiceClient.createBlobContainer(containerName); // Create the ./data/ directory and a file for uploading and downloading String localPath = "./data/"; new File(localPath).mkdirs(); String fileName = "quickstart" + java.util.UUID.randomUUID() + ".txt"; // Get a reference to a blob BlobClient blobClient = blobContainerClient.getBlobClient(fileName); // Write text to the file FileWriter writer = null; try { writer = new FileWriter(localPath + fileName, true); writer.write("Hello, World!"); writer.close(); } catch (IOException ex) { System.out.println(ex.getMessage()); } System.out.println("\nUploading to Blob storage as blob:\n\t" + blobClient.getBlobUrl()); // Upload the blob blobClient.uploadFromFile(localPath + fileName); System.out.println("\nListing blobs..."); // List the blob(s) in the container. for (BlobItem blobItem : blobContainerClient.listBlobs()) { System.out.println("\t" + blobItem.getName()); } // Download the blob to a local file // Append the string "DOWNLOAD" before the .txt extension for comparison purposes String downloadFileName = fileName.replace(".txt", "DOWNLOAD.txt"); System.out.println("\nDownloading blob to\n\t " + localPath + downloadFileName); blobClient.downloadToFile(localPath + downloadFileName); File downloadedFile = new File(localPath + downloadFileName); File localFile = new File(localPath + fileName); // Clean up resources System.out.println("\nPress the Enter key to begin clean up"); System.console().readLine(); System.out.println("Deleting blob container..."); blobContainerClient.delete(); System.out.println("Deleting the local source and downloaded files..."); localFile.delete(); downloadedFile.delete(); System.out.println("Done"); ``` -------------------------------- ### String function examples Source: https://learn.microsoft.com/en-us/azure/storage/blobs/query-acceleration-sql-reference Examples of string functions in query acceleration SQL, showing usage and results. ```sql SELECT CHARACTER_LENGTH('abcdefg') from BlobStorage ``` ```sql SELECT CHAR_LENGTH(_1) from BlobStorage ``` ```sql SELECT LOWER('AbCdEfG') from BlobStorage ``` ```sql SELECT UPPER('AbCdEfG') from BlobStorage ``` ```sql SUBSTRING('123456789', 1, 5) ``` ```sql TRIM(BOTH '123' FROM '1112211Microsoft22211122') ``` -------------------------------- ### List metric definitions with .NET SDK Source: https://learn.microsoft.com/en-us/azure/storage/blobs/monitor-blob-storage This C# example demonstrates how to list metric definitions at the account level using the MonitorManagementClient. ```csharp public static async Task ListStorageMetricDefinition() { var resourceId = ""; var subscriptionId = ""; var tenantId = ""; var applicationId = ""; var accessKey = ""; MonitorManagementClient readOnlyClient = AuthenticateWithReadOnlyClient(tenantId, applicationId, accessKey, subscriptionId).Result; IEnumerable metricDefinitions = await readOnlyClient.MetricDefinitions.ListAsync(resourceUri: resourceId, cancellationToken: new CancellationToken()); foreach (var metricDefinition in metricDefinitions) { // Enumerate metric definition: // Id // ResourceId // Name // Unit // MetricAvailabilities // PrimaryAggregationType // Dimensions // IsDimensionRequired } } ``` -------------------------------- ### Clone the sample repository Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-create-geo-redundant-storage Use git to clone the repository containing the storage sample project to your local development environment. ```bash git clone https://github.com/Azure-Samples/storage-dotnet-circuit-breaker-pattern-ha-apps-using-ra-grs.git ``` -------------------------------- ### Install fuse3 dependencies Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-troubleshooting Install fuse3 and its development headers on a Debian-based system. Required before building BlobFuse from source. ```bash sudo apt-get install fuse3 libfuse3-dev -y ``` -------------------------------- ### Install dependencies on Azure Linux Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-install Installs the FUSE and FUSE 3 development dependencies for Azure Linux distributions. ```bash sudo tdnf install fuse libfuse-dev fuse3 libfuse3-dev ``` -------------------------------- ### Install dependencies on SLES Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-install Installs the FUSE 3 development dependencies for SUSE Linux Enterprise (SLES) distributions. ```bash sudo zypper install fuse3 libfuse3-dev ``` -------------------------------- ### Create a blob container with Java Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-java Creates a new container with a unique name by appending a GUID to 'quickstartblobs' and returns a BlobContainerClient. Container names must be lowercase. Add this code to the end of the Main method. ```Java // Create a unique name for the container String containerName = "quickstartblobs" + java.util.UUID.randomUUID(); // Create the container and return a container client object BlobContainerClient blobContainerClient = blobServiceClient.createBlobContainer(containerName); ``` -------------------------------- ### Install dependencies on RHEL Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blobfuse2-install Installs the FUSE 3 development dependencies for Red Hat Enterprise Linux distributions. ```bash sudo yum install fuse3 fuse3-devel ``` -------------------------------- ### Install NuGet packages for Azure Function Source: https://learn.microsoft.com/en-us/azure/storage/blobs/archive-rehydrate-handle-event Install the required packages for the Azure Function: Azure.Storage.Blobs, Microsoft.ApplicationInsights.WorkerService, and Microsoft.Azure.WebJobs.Logging.ApplicationInsights. ```powershell Install-Package Azure.Storage.Blobs Install-Package Microsoft.ApplicationInsights.WorkerService Install-Package Microsoft.Azure.WebJobs.Logging.ApplicationInsights ``` -------------------------------- ### Response from Get-AzADUser Source: https://learn.microsoft.com/en-us/azure/storage/blobs/assign-azure-role-data-access Example response from the Get-AzADUser command, showing the security principal details and the object ID. ```text UserPrincipalName : markpdaniels@contoso.com ObjectType : User DisplayName : Mark P. Daniels Id : aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Type : aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb ``` -------------------------------- ### Custom filter: prefixMatch for blobs starting with 'b' Source: https://learn.microsoft.com/en-us/azure/storage/blobs/object-replication-overview Custom filter that replicates blobs starting with the letter 'b'. ```JSON "filters": { "prefixMatch": [ "b" ], } ``` -------------------------------- ### Initialize Azure Developer CLI template Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Initializes the azd template for the blob-storage-quickstart-nodejs quickstart repository. ```bash azd init --template blob-storage-quickstart-nodejs ``` -------------------------------- ### Install Required Azure PowerShell Modules Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-auth-abac-powershell Install specific versions of the Az, Az.Resources, and Az.Storage modules required for the tutorial. ```powershell Install-Module -Name Az -RequiredVersion 5.5.0 Install-Module -Name Az.Resources -RequiredVersion 3.2.1 Install-Module -Name Az.Storage -RequiredVersion 2.5.2-preview -AllowPrerelease ``` -------------------------------- ### Navigate to the project directory Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-encrypt-decrypt-blobs-key-vault Change the current working directory to the newly created project folder. ```bash cd BlobEncryptionKeyVault ``` -------------------------------- ### Upload command output example Source: https://learn.microsoft.com/en-us/azure/storage/blobs/blob-powershell Displays the expected output after executing the blob upload command, showing account details and a list of uploaded files. ```text AccountName: demostorageaccount, ContainerName: demo-container Name BlobType Length ContentType LastModified AccessTier IsDeleted ---- -------- ------ ----------- ------------ ---------- --------- demo-file.txt BlockBlob 222 application/octet-stream 2021-12-14 01:38:03Z Cool False hello-world.png BlockBlob 14709 application/octet-stream 2021-12-14 01:38:03Z Cool False hello-world2.png BlockBlob 12472 application/octet-stream 2021-12-14 01:38:03Z Cool False hello-world3.png BlockBlob 13537 application/octet-stream 2021-12-14 01:38:03Z Cool False ``` -------------------------------- ### Install Az.Storage module Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-directory-file-acl-powershell Installs the Az.Storage PowerShell module from the PowerShell Gallery, which is required for managing Azure Storage resources. ```powershell Install-Module Az.Storage -Repository PSGallery -Force ``` -------------------------------- ### Check PowerShell version Source: https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-directory-file-acl-powershell Verifies that PowerShell version 5.1 or higher is installed before proceeding with the Azure Storage module installation. ```powershell echo $PSVersionTable.PSVersion.ToString() ``` -------------------------------- ### Install Azure.Identity package Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet Add the Azure.Identity NuGet package to your project using the .NET CLI. ```bash dotnet add package Azure.Identity ``` -------------------------------- ### Create data directory Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-java Create a directory named data inside the blob-quickstart folder to store blob data files. ```console mkdir data ``` -------------------------------- ### Access the web app at http://localhost:1234 Source: https://learn.microsoft.com/en-us/azure/storage/blobs/quickstart-blobs-javascript-browser Use this URL in a browser to access the web app after starting it with npm start. ```http http://localhost:1234 ``` -------------------------------- ### Configure BlobClient transfer options for downloads Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-tune-upload-download-python This example demonstrates how to initialize a BlobClient with specific transfer options and perform a download with a defined concurrency level. ```python def download_blob_transfer_options(self, account_url: str, container_name: str, blob_name: str): # Create a BlobClient object with data transfer options for download blob_client = BlobClient( account_url=account_url, container_name=container_name, blob_name=blob_name, credential=DefaultAzureCredential(), max_single_get_size=1024*1024*32, # 32 MiB max_chunk_get_size=1024*1024*4, # 4 MiB connection_data_block_size=1024*4, # 4 KiB ) with open(file=os.path.join(r'file_path', 'file_name'), mode="wb") as sample_blob: download_stream = blob_client.download_blob(max_concurrency=2) sample_blob.write(download_stream.readall()) ```