Editar

Partilhar via


Restore-AzDataLakeStoreDeletedItem

Restore a deleted file or folder in Azure Data Lake.

Syntax

Restore-AzDataLakeStoreDeletedItem
       [-Account] <String>
       [-Path] <String>
       [-Destination] <String>
       [-Type] <String>
       [-RestoreAction <String>]
       [-PassThru]
       [-Force]
       [-DefaultProfile <IAzureContextContainer>]
       [<CommonParameters>]
Restore-AzDataLakeStoreDeletedItem
       [-Account] <String>
       [-DeletedItem] <DataLakeStoreDeletedItem>
       [-RestoreAction <String>]
       [-PassThru]
       [-Force]
       [-DefaultProfile <IAzureContextContainer>]
       [<CommonParameters>]

Description

The Restore-AzDataLakeStoreDeletedItem cmdlet restores a deleted file or folder in Data Lake Store. Requires the path of deleted item in trash returned by Get-AzDataLakeStoreDeletedItem. Caution: Undeleting files is a best effort operation. There are no guarantees that a file can be restored once it is deleted. The use of this API is enabled via allowlisting. If your ADL account is not allowlisted, then using this api will throw Not implemented exception. For further information and assistance please contact Microsoft support.

Examples

Example 1: Restore a file from the Data Lake Store using -force option

Restore-AzDataLakeStoreDeletedItem -Account ml1ptrashtest -Path 927e8fb1-a287-4353-b50e-3b4a39ae4088 -Destination adl://ml1ptrashtest.azuredatalake.com/test0/file_1230 -Type "file" -Force

This command restores a file from the Data Lake Store using -force option

Example 2: Restore a file from Data Lake Store using user confirmation

Restore-AzDataLakeStoreDeletedItem -Account ml1ptrashtest -Path 927e8fb1-a287-4353-b50e-3b4a39ae4088 -Destination adl://ml1ptrashtest.azuredatalake.com/test4/file_1115 -Type file

Restore user data ?
From - 927e8fb1-a287-4353-b50e-3b4a39ae4088
To   - adl://ml1ptrashtest.azuredatalake.com/test4/file_1115
Type - file
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

This command restores a file from Data Lake Store using user confirmation

Parameters

-Account

Specifies the name of the Data Lake Store account.

Type:String
Aliases:AccountName
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeletedItem

The deleted item object.

Type:DataLakeStoreDeletedItem
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Destination

The destination path to where the deleted file or folder should be restored.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Return boolean true on success.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

The path of the deleted file or folder in trash.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RestoreAction

Action to take on destination name conflicts - "copy" or "overwrite"

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Type

The type of entry being restored - "file" or "folder"

Type:String
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Outputs

None