Skip to content

Commit 7e4e36c

Browse files
authored
[Storage] Support HNS soft delete (#19256)
* support hns soft delete * fix help doc. remove commented lines * update help docs
1 parent cc0b88b commit 7e4e36c

13 files changed

+1175
-273
lines changed

src/Storage/Storage.Management.Test/ScenarioTests/StorageDataPlaneTests.ps1

Lines changed: 292 additions & 272 deletions
Large diffs are not rendered by default.

src/Storage/Storage.Management/Az.Storage.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ CmdletsToExport = 'Get-AzStorageAccount', 'Get-AzStorageAccountKey',
199199
'Set-AzStorageBlobLegalHold',
200200
'Invoke-AzRmStorageContainerImmutableStorageWithVersioningMigration',
201201
'New-AzDataLakeGen2SasToken',
202-
'New-AzStorageAccountManagementPolicyBlobIndexMatchObject'
202+
'New-AzStorageAccountManagementPolicyBlobIndexMatchObject',
203+
'Get-AzDataLakeGen2DeletedItem', 'Restore-AzDataLakeGen2DeletedItem'
203204

204205
# Variables to export from this module
205206
# VariablesToExport = @()

src/Storage/Storage.Management/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
* Supported to create or update Storage account with Azure Files Active Directory Domain Service Kerberos Authentication
2222
- `New-AzStorageAccount`
2323
- `Set-AzStorageAccount`
24+
* Supported soft delete DataLake Gen2 item
25+
- `Get-AzDataLakeGen2DeletedItem`
26+
- `Restore-AzDataLakeGen2DeletedItem`
2427

2528
## Version 4.8.0
2629
* Added check for storage account sas token is secured with the storage account key.

src/Storage/Storage.Management/help/Az.Storage.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ Enable static website for the Azure Storage account.
6565
### [Get-AzDataLakeGen2ChildItem](Get-AzDataLakeGen2ChildItem.md)
6666
Lists sub directorys and files from a directory or filesystem root.
6767

68+
### [Get-AzDataLakeGen2DeletedItem](Get-AzDataLakeGen2DeletedItem.md)
69+
List all deleted files or directories from a directory or filesystem root.
70+
6871
### [Get-AzDataLakeGen2Item](Get-AzDataLakeGen2Item.md)
6972
Gets the details of a file or directory in a filesystem.
7073

@@ -359,6 +362,9 @@ Removes a storage table.
359362
### [Remove-AzStorageTableStoredAccessPolicy](Remove-AzStorageTableStoredAccessPolicy.md)
360363
Removes a stored access policy from an Azure storage table.
361364

365+
### [Restore-AzDataLakeGen2DeletedItem](Restore-AzDataLakeGen2DeletedItem.md)
366+
Restores a deleted file or directory in a filesystem.
367+
362368
### [Restore-AzRmStorageShare](Restore-AzRmStorageShare.md)
363369
Restores a deleted file share.
364370

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
---
2+
external help file: Microsoft.Azure.PowerShell.Cmdlets.Storage.dll-Help.xml
3+
Module Name: Az.Storage
4+
online version: https://docs.microsoft.com/powershell/module/az.storage/get-azdatalakegen2deleteditem
5+
schema: 2.0.0
6+
---
7+
8+
# Get-AzDataLakeGen2DeletedItem
9+
10+
## SYNOPSIS
11+
List all deleted files or directories from a directory or filesystem root.
12+
13+
## SYNTAX
14+
15+
```
16+
Get-AzDataLakeGen2DeletedItem [-FileSystem] <String> [[-Path] <String>] [-MaxCount <Int32>]
17+
[-ContinuationToken <String>] [-AsJob] [-Context <IStorageContext>] [-DefaultProfile <IAzureContextContainer>]
18+
[<CommonParameters>]
19+
```
20+
21+
## DESCRIPTION
22+
The **Get-AzDataLakeGen2DeletedItem** cmdlet lists all deleted files or directories from a directory or filesystem in an Azure storage account.
23+
This cmdlet only works if Hierarchical Namespace is enabled for the Storage account. This kind of account can be created by run "New-AzStorageAccount" cmdlet with "-EnableHierarchicalNamespace $true".
24+
25+
## EXAMPLES
26+
27+
### Example 1: List all deleted files or directories from a Filesystem
28+
```powershell
29+
Get-AzDataLakeGen2DeletedItem -FileSystem "filesystem1"
30+
```
31+
32+
```output
33+
FileSystem Name: filesystem1
34+
35+
Path DeletionId DeletedOn RemainingRetentionDays
36+
---- ---------- --------- ----------------------
37+
dir0/dir1/file1 132658816156507617 2021-05-19 07:06:55Z 3
38+
dir0/dir2 132658834541610122 2021-05-19 07:37:34Z 3
39+
dir0/dir2/file3 132658834534174806 2021-05-19 07:37:33Z 3
40+
```
41+
42+
This command lists all deleted files or directories from a Filesystem.
43+
44+
### Example 2: List all deleted files or directories from a directory
45+
```powershell
46+
Get-AzDataLakeGen2DeletedItem -FileSystem "filesystem1" -Path dir0/dir2
47+
```
48+
```output
49+
FileSystem Name: filesystem1
50+
51+
Path DeletionId DeletedOn RemainingRetentionDays
52+
---- ---------- --------- ----------------------
53+
dir0/dir2 132658834541610122 2021-05-19 07:37:34Z 3
54+
dir0/dir2/file3 132658834534174806 2021-05-19 07:37:33Z 3
55+
```
56+
57+
This command lists all deleted files or directories from a directory.
58+
59+
## PARAMETERS
60+
61+
### -AsJob
62+
Run cmdlet in the background
63+
64+
```yaml
65+
Type: System.Management.Automation.SwitchParameter
66+
Parameter Sets: (All)
67+
Aliases:
68+
69+
Required: False
70+
Position: Named
71+
Default value: None
72+
Accept pipeline input: False
73+
Accept wildcard characters: False
74+
```
75+
76+
### -Context
77+
Azure Storage Context Object
78+
79+
```yaml
80+
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext
81+
Parameter Sets: (All)
82+
Aliases:
83+
84+
Required: False
85+
Position: Named
86+
Default value: None
87+
Accept pipeline input: True (ByPropertyName, ByValue)
88+
Accept wildcard characters: False
89+
```
90+
91+
### -ContinuationToken
92+
Continuation Token.
93+
94+
```yaml
95+
Type: System.String
96+
Parameter Sets: (All)
97+
Aliases:
98+
99+
Required: False
100+
Position: Named
101+
Default value: None
102+
Accept pipeline input: False
103+
Accept wildcard characters: False
104+
```
105+
106+
### -DefaultProfile
107+
The credentials, account, tenant, and subscription used for communication with Azure.
108+
109+
```yaml
110+
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
111+
Parameter Sets: (All)
112+
Aliases: AzureRmContext, AzureCredential
113+
114+
Required: False
115+
Position: Named
116+
Default value: None
117+
Accept pipeline input: False
118+
Accept wildcard characters: False
119+
```
120+
121+
### -FileSystem
122+
FileSystem name
123+
124+
```yaml
125+
Type: System.String
126+
Parameter Sets: (All)
127+
Aliases:
128+
129+
Required: True
130+
Position: 0
131+
Default value: None
132+
Accept pipeline input: True (ByValue)
133+
Accept wildcard characters: False
134+
```
135+
136+
### -MaxCount
137+
The max count of the blobs that can return.
138+
139+
```yaml
140+
Type: System.Nullable`1[System.Int32]
141+
Parameter Sets: (All)
142+
Aliases:
143+
144+
Required: False
145+
Position: Named
146+
Default value: None
147+
Accept pipeline input: False
148+
Accept wildcard characters: False
149+
```
150+
151+
### -Path
152+
The path in the specified FileSystem that should be retrieved.
153+
Can be a directory In the format 'directory1/directory2/', Skip set this parameter to list items from root directory of the Filesystem.
154+
155+
```yaml
156+
Type: System.String
157+
Parameter Sets: (All)
158+
Aliases:
159+
160+
Required: False
161+
Position: 1
162+
Default value: None
163+
Accept pipeline input: True (ByValue)
164+
Accept wildcard characters: False
165+
```
166+
167+
### CommonParameters
168+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
169+
170+
## INPUTS
171+
172+
### System.String
173+
174+
### Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext
175+
176+
## OUTPUTS
177+
178+
### Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureDataLakeGen2DeletedItem
179+
180+
## NOTES
181+
182+
## RELATED LINKS

0 commit comments

Comments
 (0)