The Update-AzDataLakeGen2Item cmdlet updates a file or directory on properties, metadata, permission, ACL, and owner.
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".
Examples
Example 1: Create an ACL object with 3 ACL entry, and update ACL to all items in a Filesystem recursively
This command first creates an ACL object with 3 acl entry (use -InputObject parameter to add acl entry to existing acl object), then get all items in a filesystem and update acl on the items.
Example 2: Update all properties on a file, and show them
This command updates all properties on a file (ACL, permission,owner, group, metadata, property can be updated with any combination), and show them in Powershell console.
Example 3: Add an ACL entry to a directory
## Get the origin ACL
$acl = (Get-AzDataLakeGen2Item -FileSystem "filesystem1" -Path 'dir1/dir3/').ACL
# Update permission of a new ACL entry (if ACL entry with same AccessControlType/EntityId/DefaultScope not exist, will add a new ACL entry, else update permission of existing ACL entry)
$acl = Set-AzDataLakeGen2ItemAclObject -AccessControlType user -EntityId $id -Permission rw- -InputObject $acl
# set the new acl to the directory
Update-AzDataLakeGen2Item -FileSystem "filesystem1" -Path 'dir1/dir3/' -ACL $acl
This command gets ACL from a directory, updates/adds an ACL entry, and sets back to the directory.
If ACL entry with same AccessControlType/EntityId/DefaultScope not exist, will add a new ACL entry, else update permission of existing ACL entry.
Parameters
-Acl
Sets POSIX access control rights on files and directories.
Create this object with New-AzDataLakeGen2ItemAclObject.
The path in the specified Filesystem that should be updated.
Can be a file or directory In the format 'directory/file.txt' or 'directory1/directory2/'.
Not specify this parameter will update the root directory of the Filesystem.
Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. Symbolic (rwxrw-rw-) is supported.
The sticky bit is also supported and its represented either by the letter t or T in the final character-place depending on whether the execution bit for the others category is set or unset respectively,
absence of t or T indicates sticky bit not set.Invalid in conjunction with ACL.
Specifies properties for the directory or file.
The supported properties for file are: CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentMD5, ContentType.
The supported properties for directory are: CacheControl, ContentDisposition, ContentEncoding, ContentLanguage.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.