Skip to content

Commit 64cf92b

Browse files
CopilotBillWagner
andcommitted
Fix F# Azure Blob Storage documentation v11 to v12 API issues
Co-authored-by: BillWagner <[email protected]>
1 parent 513a29a commit 64cf92b

File tree

4 files changed

+8
-29
lines changed

4 files changed

+8
-29
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](https://learn.microsoft.com/dotnet/api/overview/azure/identity-readme) for enhanced security.
1516

1617
## Prerequisites
1718

@@ -90,7 +91,7 @@ To upload a file to a block blob, get a container client and use it to get a blo
9091

9192
## List the blobs in a container
9293

93-
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`.
94+
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.
9495

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

@@ -134,7 +135,7 @@ To delete a blob, first get a blob reference and then call the
134135

135136
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.
136137

137-
This example shows a hierarchical listing, by using the `GetBlobsByHierarchy` method of the `BlobClient` .
138+
This example shows a hierarchical listing, by using the `GetBlobsByHierarchy` method of the `BlobContainerClient`.
138139

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

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}"

samples/snippets/fsharp/azure/test-script.fsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

samples/snippets/fsharp/azure/test.fsproj

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)