From bbd48c1ec9318e3b06ae9733fba1f6ebe83c4177 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Sep 2025 20:55:41 +0000 Subject: [PATCH 1/4] Initial plan From 513a29a5ce9101bb7f2975ff3a428dbf182b1098 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Sep 2025 21:01:42 +0000 Subject: [PATCH 2/4] Initial analysis of Azure Blob Storage F# documentation Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com> --- samples/snippets/fsharp/azure/test-script.fsx | 9 +++++++++ samples/snippets/fsharp/azure/test.fsproj | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 samples/snippets/fsharp/azure/test-script.fsx create mode 100644 samples/snippets/fsharp/azure/test.fsproj diff --git a/samples/snippets/fsharp/azure/test-script.fsx b/samples/snippets/fsharp/azure/test-script.fsx new file mode 100644 index 0000000000000..a46eba52726ec --- /dev/null +++ b/samples/snippets/fsharp/azure/test-script.fsx @@ -0,0 +1,9 @@ +#r "nuget: Azure.Storage.Blobs" +open Azure.Storage.Blobs +open Azure.Storage.Blobs.Models +open Azure.Storage.Blobs.Specialized + +// Test if the APIs work +let testConnection = "DefaultEndpointsProtocol=https;AccountName=test;AccountKey=test;EndpointSuffix=core.windows.net" +let container = BlobContainerClient(testConnection, "test") +printfn "Container client created successfully using v12 SDK" \ No newline at end of file diff --git a/samples/snippets/fsharp/azure/test.fsproj b/samples/snippets/fsharp/azure/test.fsproj new file mode 100644 index 0000000000000..05a5a33b4ef25 --- /dev/null +++ b/samples/snippets/fsharp/azure/test.fsproj @@ -0,0 +1,12 @@ + + + + net8.0 + Exe + + + + + + + \ No newline at end of file From 64cf92bad0701f017f5dcec0dafa40f4b4581b9a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Sep 2025 21:07:46 +0000 Subject: [PATCH 3/4] Fix F# Azure Blob Storage documentation v11 to v12 API issues Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com> --- docs/fsharp/using-fsharp-on-azure/blob-storage.md | 7 ++++--- samples/snippets/fsharp/azure/blob-storage.fsx | 9 ++++----- samples/snippets/fsharp/azure/test-script.fsx | 9 --------- samples/snippets/fsharp/azure/test.fsproj | 12 ------------ 4 files changed, 8 insertions(+), 29 deletions(-) delete mode 100644 samples/snippets/fsharp/azure/test-script.fsx delete mode 100644 samples/snippets/fsharp/azure/test.fsproj diff --git a/docs/fsharp/using-fsharp-on-azure/blob-storage.md b/docs/fsharp/using-fsharp-on-azure/blob-storage.md index e21dd99338eb2..cdd48c6394ce7 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](https://learn.microsoft.com/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}" diff --git a/samples/snippets/fsharp/azure/test-script.fsx b/samples/snippets/fsharp/azure/test-script.fsx deleted file mode 100644 index a46eba52726ec..0000000000000 --- a/samples/snippets/fsharp/azure/test-script.fsx +++ /dev/null @@ -1,9 +0,0 @@ -#r "nuget: Azure.Storage.Blobs" -open Azure.Storage.Blobs -open Azure.Storage.Blobs.Models -open Azure.Storage.Blobs.Specialized - -// Test if the APIs work -let testConnection = "DefaultEndpointsProtocol=https;AccountName=test;AccountKey=test;EndpointSuffix=core.windows.net" -let container = BlobContainerClient(testConnection, "test") -printfn "Container client created successfully using v12 SDK" \ No newline at end of file diff --git a/samples/snippets/fsharp/azure/test.fsproj b/samples/snippets/fsharp/azure/test.fsproj deleted file mode 100644 index 05a5a33b4ef25..0000000000000 --- a/samples/snippets/fsharp/azure/test.fsproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net8.0 - Exe - - - - - - - \ No newline at end of file From dfa79218d84c66a25873a4aa2fb20f1a88fb80de Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 24 Sep 2025 09:49:12 -0400 Subject: [PATCH 4/4] Update docs/fsharp/using-fsharp-on-azure/blob-storage.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/fsharp/using-fsharp-on-azure/blob-storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/fsharp/using-fsharp-on-azure/blob-storage.md b/docs/fsharp/using-fsharp-on-azure/blob-storage.md index cdd48c6394ce7..c90ad34e144d1 100644 --- a/docs/fsharp/using-fsharp-on-azure/blob-storage.md +++ b/docs/fsharp/using-fsharp-on-azure/blob-storage.md @@ -12,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 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. +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