#
# More info here: https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-directory-file-acl-powershell
#
Login-AzAccount

$ResourceGroupName = '<RESOURCE GROUP NAME>'
$StorageAccountName = '<STORAGE ACCOUNT NAME>'
$filesystemName = 'cont1'
$dirpath = "folderx/y/z1/"

# Important! You need the right version of Az.Storage as these cmdlets are not GA..
if (Get-Module -Name Az.Storage -ListAvailable | Where-Object {$_.Version -eq '1.9.1'})  {
    Write-Host "Az.Storage version 1.9.1 found." -ForegroundColor Cyan
}
else {
    Write-Host "Az.Storage version 1.9.1 not found. Installing.." -ForegroundColor Cyan
    install-Module Az.Storage -Repository PSGallery -RequiredVersion 1.9.1-preview –AllowPrerelease –AllowClobber –Force -Verbose -SkipPublisherCheck
}
Get-Module AZ.Storage | Remove-Module; Import-Module Az.Storage -RequiredVersion 1.9.1 -Scope Local 

$storageAccount = Get-AzStorageAccount -ResourceGroupName $ResourceGroupName  -AccountName $StorageAccountName; $ctx = $storageAccount.Context

# upload some sample files..
for ($i = 1; $i -le 10; $i++)  {
    $filepath = "c:\temp\file$i.txt"
    set-content -Path $filepath -Value "The value is $i"
    $destPath = $dirpath + (Get-Item $filepath).Name
    New-AzDataLakeGen2Item -Context $ctx -FileSystem $filesystemName -Path $destPath -Source $filepath -Force 
    Remove-Item -Path $filepath
}

#Get a directory
$dirObj =  Get-AzDataLakeGen2Item -Context $ctx -FileSystem $filesystemName  -Path $dirpath -ErrorAction SilentlyContinue
$dirObj.ACL

# Get a file
$file = Get-AzDataLakeGen2Item -Context $ctx -FileSystem $filesystemName -Path "$($dirpath)file1.txt"
$file.ACL