你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Restore-AzDataLakeGen2DeletedItem
还原文件系统中已删除的文件或目录。
语法
Restore-AzDataLakeGen2DeletedItem
[-FileSystem] <String>
[-Path] <String>
[-DeletionId] <String>
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Restore-AzDataLakeGen2DeletedItem
-InputObject <AzureDataLakeGen2DeletedItem>
[-AsJob]
[-Context <IStorageContext>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Restore-AzDataLakeGen2DeletedItem cmdlet 还原 Azure 存储帐户中文件系统中的已删除文件或目录。 仅当为存储帐户启用了分层命名空间时,此 cmdlet 才有效。 可以使用“-EnableHierarchicalNamespace $true”运行“New-AzStorageAccount”cmdlet 来创建此类帐户。
示例
示例 1:列出文件系统中的所有已删除文件或目录,并按管道还原它们
$items = Get-AzDataLakeGen2DeletedItem -FileSystem "filesystem1"
$items
FileSystem Name: filesystem1
Path DeletionId DeletedOn RemainingRetentionDays
---- ---------- --------- ----------------------
dir0/dir1/file1 132658816156507617 2021-05-19 07:06:55Z 3
dir0/dir2 132658834541610122 2021-05-19 07:37:34Z 3
dir0/dir2/file3 132658834534174806 2021-05-19 07:37:33Z 3
$items | Restore-AzDataLakeGen2DeletedItem
FileSystem Name: filesystem1
Path IsDirectory Length LastModified Permissions Owner Group
---- ----------- ------ ------------ ----------- ----- -----
dir0/dir1/file1 False 1024 2021-05-19 07:06:39Z rw-r----- $superuser $superuser
dir0/dir2 True 2021-05-19 07:06:37Z rwxr-x--- $superuser $superuser
dir0/dir2/file3 False 1024 2021-05-19 07:06:42Z rw-r----- $superuser $superuser
此命令列出文件系统中的所有已删除文件或目录,按管道还原所有这些文件。
示例 2:使用 path 和 DeletionId 还原单个文件
Restore-AzDataLakeGen2DeletedItem -FileSystem "filesystem1" -Path dir0/dir1/file1 -DeletionId 132658838415219780
FileSystem Name: filesystem1
Path IsDirectory Length LastModified Permissions Owner Group
---- ----------- ------ ------------ ----------- ----- -----
dir0/dir1/file1 False 1024 2021-05-19 07:06:39Z rw-r----- $superuser $superuser
此命令使用 path 和 DeletionId 还原单个文件。 可以使用“Get-AzDataLakeGen2DeletedItem”cmdlet 获取 DeleteId。
参数
-AsJob
在后台运行 cmdlet
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Context
Azure 存储上下文对象
类型: | IStorageContext |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DeletionId
与软删除路径关联的删除 ID。 可以使用 cmdlet“Get-AzDataLakeGen2DeletedItem”获取软删除路径及其 assocaited 删除 ID。
类型: | String |
Position: | 2 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-FileSystem
FileSystem 名称
类型: | String |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-InputObject
要还原的 Azure Datalake Gen2 已删除项对象。
类型: | AzureDataLakeGen2DeletedItem |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Path
应还原的指定 FileSystem 中的已删除项路径。 格式为“directory/file.txt”或“directory1/directory2/”
类型: | String |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |