You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/storage/blobs/versioning-enable.md
+62-3Lines changed: 62 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ author: normesta
7
7
8
8
ms.service: storage
9
9
ms.topic: how-to
10
-
ms.date: 06/07/2021
10
+
ms.date: 01/25/2023
11
11
ms.author: normesta
12
12
ms.subservice: blobs
13
13
ms.custom: devx-track-azurepowershell
@@ -21,6 +21,8 @@ This article shows how to enable or disable blob versioning for the storage acco
21
21
22
22
## Enable blob versioning
23
23
24
+
You can enable blob versioning with the Azure portal, PowerShell, Azure CLI, or an Azure Resource Manager template.
25
+
24
26
# [Azure portal](#tab/portal)
25
27
26
28
To enable blob versioning for a storage account in the Azure portal:
@@ -29,7 +31,7 @@ To enable blob versioning for a storage account in the Azure portal:
29
31
1. Under **Blob service**, choose **Data protection**.
30
32
1. In the **Versioning** section, select **Enabled**.
31
33
32
-
:::image type="content" source="media/versioning-enable/portal-enable-versioning.png" alt-text="Screenshot showing how to enable blob versioning in Azure portal":::
34
+
:::image type="content" source="media/versioning-enable/portal-enable-versioning.png" alt-text="Screenshot showing how to enable blob versioning in Azure portal":::
33
35
34
36
# [PowerShell](#tab/powershell)
35
37
@@ -91,6 +93,63 @@ For more information about deploying resources with templates in the Azure porta
91
93
92
94
---
93
95
96
+
## List blob versions with .NET
97
+
98
+
To display a blob's versions, use the Azure portal, PowerShell, or Azure CLI. You can also list a blob's versions using one of the Blob Storage SDKs.
99
+
100
+
# [Azure portal](#tab/portal)
101
+
102
+
To list a blob's versions in the Azure portal:
103
+
104
+
1. Navigate to your storage account in the portal, then navigate to the container that contains your blob.
105
+
1. Select the blob for which you want to list versions.
106
+
1. Select the **Versions** tab to display the blob's versions.
107
+
108
+
:::image type="content" source="media/versioning-enable/portal-list-blob-versions.png" alt-text="Screenshot showing how to list blob versions in the Azure portal":::
109
+
110
+
# [PowerShell](#tab/powershell)
111
+
112
+
To list a blob's versions with PowerShell, call the [Get-AzStorageBlob](/powershell/module/az.storage/get-azstorageblob) command with the `-IncludeVersion` parameter:
To list a blob's versions with Azure CLI, call the [az storage blob directory list](/cli/azure/storage/blob/directory#az-storage-blob-directory-list) command with the `--include v` parameter:
132
+
133
+
```azurecli
134
+
storageAccount="<storage-account>"
135
+
containerName="<container-name>"
136
+
137
+
az storage blob list \
138
+
--container-name $containerName \
139
+
--prefix "ab" \
140
+
--query "[[].name, [].versionId]" \
141
+
--account-name $storageAccount \
142
+
--include v \
143
+
--auth-mode login \
144
+
--output tsv
145
+
```
146
+
147
+
# [Template](#tab/template)
148
+
149
+
N/A
150
+
151
+
---
152
+
94
153
## Modify a blob to trigger a new version
95
154
96
155
The following code example shows how to trigger the creation of a new version with the Azure Storage client library for .NET, version [12.5.1](https://www.nuget.org/packages/Azure.Storage.Blobs/12.5.1) or later. Before running this example, make sure you have enabled versioning for your storage account.
@@ -99,7 +158,7 @@ The example creates a block blob, and then updates the blob's metadata. Updating
To list blob versions or snapshots with the .NET v12 client library, specify the [BlobStates](/dotnet/api/azure.storage.blobs.models.blobstates) parameter with the **Version** field.
0 commit comments