diff --git a/docs/fsharp/using-fsharp-on-azure/blob-storage.md b/docs/fsharp/using-fsharp-on-azure/blob-storage.md index e21dd99338eb2..c90ad34e144d1 100644 --- a/docs/fsharp/using-fsharp-on-azure/blob-storage.md +++ b/docs/fsharp/using-fsharp-on-azure/blob-storage.md @@ -4,6 +4,7 @@ description: Store unstructured data in the cloud with Azure Blob Storage. author: sylvanc ms.date: 09/17/2024 ms.custom: "devx-track-fsharp" +ai-usage: ai-assisted --- # Get started with Azure Blob Storage using F\# @@ -11,7 +12,7 @@ Azure Blob Storage is a service that stores unstructured data in the cloud as ob This article shows you how to perform common tasks using Blob storage. The samples are written using F# using the Azure Storage Client Library for .NET. The tasks covered include how to upload, list, download, and delete blobs. -For a conceptual overview of blob storage, see [the .NET guide for blob storage](/azure/storage/blobs/storage-quickstart-blobs-dotnet). For ease, these tutorials use [connection strings](/azure/storage/storage-configure-connection-string) to authenticate with Azure. For optimal security, you should use Microsoft Entra ID with [managed identities](/entra/identity/managed-identities-azure-resources/). +For a conceptual overview of blob storage, see [the .NET guide for blob storage](/azure/storage/blobs/storage-quickstart-blobs-dotnet). For ease, these tutorials use [connection strings](/azure/storage/storage-configure-connection-string) to authenticate with Azure. For production applications, you should use Microsoft Entra ID with [managed identities](/entra/identity/managed-identities-azure-resources/) or the [Azure.Identity library](/dotnet/api/overview/azure/identity-readme) for enhanced security. ## Prerequisites @@ -90,7 +91,7 @@ To upload a file to a block blob, get a container client and use it to get a blo ## List the blobs in a container -To list the blobs in a container, first get a container reference. You can then use the container's `GetBlobs` method to retrieve the blobs and/or directories within it. To access the rich set of properties and methods for a returned `BlobItem`. +To list the blobs in a container, first get a container reference. You can then use the container's `GetBlobsByHierarchy` method to retrieve the blobs and/or directories within it. This method returns `BlobItem` objects that provide access to blob properties and metadata. [!code-fsharp[BlobStorage](../../../samples/snippets/fsharp/azure/blob-storage.fsx#L57-L58)] @@ -134,7 +135,7 @@ To delete a blob, first get a blob reference and then call the If you are listing a large number of blobs, or you want to control the number of results you return in one listing operation, you can list blobs in pages of results. This example shows how to return results in pages. -This example shows a hierarchical listing, by using the `GetBlobsByHierarchy` method of the `BlobClient` . +This example shows a hierarchical listing, by using the `GetBlobsByHierarchy` method of the `BlobContainerClient`. [!code-fsharp[BlobStorage](../../../samples/snippets/fsharp/azure/blob-storage.fsx#L88-L100)] diff --git a/samples/snippets/fsharp/azure/blob-storage.fsx b/samples/snippets/fsharp/azure/blob-storage.fsx index 8ac4f7b1fc929..77e34963a6327 100644 --- a/samples/snippets/fsharp/azure/blob-storage.fsx +++ b/samples/snippets/fsharp/azure/blob-storage.fsx @@ -102,8 +102,7 @@ let ListBlobsSegmentedInHierarchicalListing(container:BlobContainerClient) = // Create some dummy data by uploading the same file over and over again for i in 1 .. 100 do - let blob = container.GetBlobClient($"myblob{i}.txt") - use fileStream = System.IO.File.OpenRead(localFile) + let blob = container.GetBlobClient($"myblob{i}.txt") blob.Upload(localFile) ListBlobsSegmentedInHierarchicalListing container @@ -122,8 +121,8 @@ appendContainer.CreateIfNotExists() |> ignore let appendBlob = appendContainer.GetAppendBlobClient("append-blob.log") // Create the append blob. Note that if the blob already exists, the -// CreateOrReplace() method will overwrite it. You can check whether the -// blob exists to avoid overwriting it by using CloudAppendBlob.Exists(). +// CreateIfNotExists() method will overwrite it. You can check whether the +// blob exists to avoid overwriting it by using appendBlob.Exists(). appendBlob.CreateIfNotExists() let numBlocks = 10 @@ -142,5 +141,5 @@ for i in 0 .. numBlocks - 1 do appendBlob.AppendBlock(stream) // Read the append blob to the console window. -let downloadedText = appendBlob.DownloadContent().ToString() +let downloadedText = appendBlob.DownloadContent().Value.Content.ToString() printfn $"{downloadedText}"