Skip to content

Commit a59ffda

Browse files
CopilotBillWagnergewarren
authored
Fix F# Azure Blob Storage documentation v11 to v12 API inconsistencies (dotnet#48664)
* Initial plan * Initial analysis of Azure Blob Storage F# documentation Co-authored-by: BillWagner <[email protected]> * Fix F# Azure Blob Storage documentation v11 to v12 API issues Co-authored-by: BillWagner <[email protected]> * Update docs/fsharp/using-fsharp-on-azure/blob-storage.md Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BillWagner <[email protected]> Co-authored-by: Bill Wagner <[email protected]> Co-authored-by: Genevieve Warren <[email protected]>
1 parent 70372ad commit a59ffda

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

docs/fsharp/using-fsharp-on-azure/blob-storage.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ description: Store unstructured data in the cloud with Azure Blob Storage.
44
author: sylvanc
55
ms.date: 09/17/2024
66
ms.custom: "devx-track-fsharp"
7+
ai-usage: ai-assisted
78
---
89
# Get started with Azure Blob Storage using F\#
910

1011
Azure Blob Storage is a service that stores unstructured data in the cloud as objects/blobs. Blob storage can store any type of text or binary data, such as a document, media file, or application installer. Blob storage is also referred to as object storage.
1112

1213
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.
1314

14-
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/).
15+
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.
1516

1617
> [!NOTE]
1718
> This article uses the standard Azure Storage Client Library for .NET. F# developers might consider the [FSharp.Azure.Blob](https://github.com/random82/FSharp.Azure.Blob) library, which provides a more idiomatic F# API for working with Azure Blob Storage. This community library offers idiomatic F# functions and patterns that make blob operations more natural in F#.
@@ -93,7 +94,7 @@ To upload a file to a block blob, get a container client and use it to get a blo
9394

9495
## List the blobs in a container
9596

96-
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`.
97+
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.
9798

9899
[!code-fsharp[BlobStorage](../../../samples/snippets/fsharp/azure/blob-storage.fsx#L57-L58)]
99100

@@ -137,7 +138,7 @@ To delete a blob, first get a blob reference and then call the
137138

138139
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.
139140

140-
This example shows a hierarchical listing, by using the `GetBlobsByHierarchy` method of the `BlobClient` .
141+
This example shows a hierarchical listing, by using the `GetBlobsByHierarchy` method of the `BlobContainerClient`.
141142

142143
[!code-fsharp[BlobStorage](../../../samples/snippets/fsharp/azure/blob-storage.fsx#L88-L100)]
143144

samples/snippets/fsharp/azure/blob-storage.fsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ let ListBlobsSegmentedInHierarchicalListing(container:BlobContainerClient) =
102102

103103
// Create some dummy data by uploading the same file over and over again
104104
for i in 1 .. 100 do
105-
let blob = container.GetBlobClient($"myblob{i}.txt")
106-
use fileStream = System.IO.File.OpenRead(localFile)
105+
let blob = container.GetBlobClient($"myblob{i}.txt")
107106
blob.Upload(localFile)
108107

109108
ListBlobsSegmentedInHierarchicalListing container
@@ -122,8 +121,8 @@ appendContainer.CreateIfNotExists() |> ignore
122121
let appendBlob = appendContainer.GetAppendBlobClient("append-blob.log")
123122

124123
// Create the append blob. Note that if the blob already exists, the
125-
// CreateOrReplace() method will overwrite it. You can check whether the
126-
// blob exists to avoid overwriting it by using CloudAppendBlob.Exists().
124+
// CreateIfNotExists() method will overwrite it. You can check whether the
125+
// blob exists to avoid overwriting it by using appendBlob.Exists().
127126
appendBlob.CreateIfNotExists()
128127

129128
let numBlocks = 10
@@ -142,5 +141,5 @@ for i in 0 .. numBlocks - 1 do
142141
appendBlob.AppendBlock(stream)
143142

144143
// Read the append blob to the console window.
145-
let downloadedText = appendBlob.DownloadContent().ToString()
144+
let downloadedText = appendBlob.DownloadContent().Value.Content.ToString()
146145
printfn $"{downloadedText}"

0 commit comments

Comments
 (0)