Cmdleten Remove-AzDataLakeGen2AclRecursive tar bort ACL rekursivt på den angivna sökvägen.
ACL-posterna i den ursprungliga ACL:n, som har samma AccessControlType, DefaultScope och EntityId med indata-ACL-poster (även med olika behörighet) kommer att tas bort.
Exempel
Exempel 1: Ta bort ACL rekursivt i en rotkatalog i filsystemet
$acl = Set-AzDataLakeGen2ItemAclObject -AccessControlType user -EntityId $id -Permission r-x -DefaultScope
$acl = Set-AzDataLakeGen2ItemAclObject -AccessControlType user -EntityId $id -Permission r-x -InputObject $acl
Remove-AzDataLakeGen2AclRecursive -FileSystem "filesystem1" -Acl $acl -Context $ctx
WARNING: To find the ACL Entry to remove, will only compare AccessControlType, DefaultScope and EntityId, will omit Permission.
FailedEntries :
TotalDirectoriesSuccessfulCount : 7
TotalFilesSuccessfulCount : 5
TotalFailureCount : 0
ContinuationToken :
Det här kommandot skapar först ett ACL-objekt med 2 acl-poster och tar sedan bort ACL rekursivt i en rotkatalog i ett filsystem.
Exempel 2: Ta bort ACL rekursivt i en katalog
$result = Remove-AzDataLakeGen2AclRecursive -FileSystem "filesystem1" -Path "dir1" -Acl $acl -Context $ctx
WARNING: To find the ACL Entry to remove, will only compare AccessControlType, DefaultScope and EntityId, will omit Permission.
$result
FailedEntries : {dir1/dir2/file4}
TotalDirectoriesSuccessfulCount : 500
TotalFilesSuccessfulCount : 2500
TotalFailureCount : 1
ContinuationToken : VBaHi5TfyO2ai1wYTRhIL2FjbGNibjA2c3RmATAxRDVEN0UzRENFQzZCRTAvYWRsc3Rlc3QyATAxRDY2M0ZCQTZBN0JGQTkvZGlyMC9kaXIxL2ZpbGUzFgAAAA==
$result.FailedEntries
Name IsDirectory ErrorMessage
---- ----------- ------------
dir0/dir2/file4 False This request is not authorized to perform this operation using this permission.
# user need fix the failed item , then can resume with ContinuationToken
$result = Remove-AzDataLakeGen2AclRecursive -FileSystem "filesystem1" -Path "dir1" -Acl $acl -ContinuationToken $result.ContinuationToken -Context $ctx
WARNING: To find the ACL Entry to remove, will only compare AccessControlType, DefaultScope and EntityId, will omit Permission.
$result
FailedEntries :
TotalDirectoriesSuccessfulCount : 100
TotalFilesSuccessfulCount : 1000
TotalFailureCount : 0
ContinuationToken :
Det här kommandot tar först bort ACL rekursivt i en katalog och misslyckades och återupptar sedan med ContinuationToken när användaren har korrigerat den misslyckade filen.
Exempel 3: Ta bort ACL rekursivt segment för segment
Det här skriptet tar bort ACL rekursivt i katalogsegment efter segment, med segmentstorlek som BatchSize * MaxBatchCount. Segmentstorleken är 50000 i det här skriptet.
Exempel 4: Ta bort ACL rekursivt i en katalog och ContinueOnFailure och återuppta sedan från fel en efter en
$result = Remove-AzDataLakeGen2AclRecursive -FileSystem "filesystem1" -Path "dir1" -Acl $acl -ContinueOnFailure -Context $ctx
$result
FailedEntries : {dir0/dir1/file1, dir0/dir2/file4}
TotalDirectoriesSuccessfulCount : 100
TotalFilesSuccessfulCount : 500
TotalFailureCount : 2
ContinuationToken : VBaHi5TfyO2ai1wYTRhIL2FjbGNibjA2c3RmATAxRDVEN0UzRENFQzZCRTAvYWRsc3Rlc3QyATAxRDY2M0ZCQTZBN0JGQTkvZGlyMC9kaXIxL2ZpbGUzFgAAAA==
$result.FailedEntries
Name IsDirectory ErrorMessage
---- ----------- ------------
dir0/dir1/file1 False This request is not authorized to perform this operation using this permission.
dir0/dir2/file4 False This request is not authorized to perform this operation using this permission.
# user need fix the failed item , then can resume with ContinuationToken
foreach ($path in $result.FailedEntries.Name)
{
# user code to fix failed entry in $path
#set ACL again
Remove-AzDataLakeGen2AclRecursive -FileSystem "filesystem1" -Path $path -Acl $acl -Context $ctx
}
Det här kommandot tar först bort ACL rekursivt till en katalog med ContinueOnFailure, och vissa objekt misslyckades och återupptar sedan de misslyckade objekten en efter en.
Parametrar
-Acl
POSIX-åtkomstkontrollistan som ska ställas in rekursivt för filen eller katalogen.
Om datauppsättningens storlek överskrider batchstorleken delas åtgärden upp i flera begäranden så att förloppet kan spåras.
Batchstorleken ska vara mellan 1 och 2000.
Standardvärdet är 2000.
Ange den här parametern för att ignorera fel och fortsätta bearbetningen med åtgärden på andra underentiteter i katalogen. Standardåtgärden avslutas snabbt vid fel.
Maximalt antal batchar som en ändringsåtgärd för åtkomstkontroll kan köras. Om datamängdens storlek överskrider MaxBatchCount multiplicerar BatchSize returneras fortsättningstoken.
Sökvägen i det angivna FileSystem som du vill ändra Acl rekursivt.
Kan vara en fil eller katalog.
I formatet "directory/file.txt" eller "directory1/directory2/".
Hoppa över att ange den här parametern för att ändra Acl rekursivt från rotkatalogen i filsystemet.
Den här cmdleten stöder vanliga parametrar: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction och -WarningVariable. Mer information finns i about_CommonParameters.
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.