You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -30,27 +30,27 @@ This article shows you how to use PowerShell to create and manage directories, f
30
30
31
31
## Install PowerShell modules
32
32
33
-
1. Verify that the version of PowerShell that have installed is `5.1` or higher by using the following command.
33
+
1. Verify that the version of PowerShell that have installed is `5.1` or higher by using the following command.
34
34
35
-
```powershell
36
-
echo $PSVersionTable.PSVersion.ToString()
37
-
```
35
+
```powershell
36
+
echo $PSVersionTable.PSVersion.ToString()
37
+
```
38
38
39
-
To upgrade your version of PowerShell, see [Upgrading existing Windows PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell)
39
+
To upgrade your version of PowerShell, see [Upgrading existing Windows PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell)
40
40
41
-
2. Install the latest **PowershellGet** module. Then, close and reopen the Powershell console.
41
+
2. Install the latest **PowershellGet** module. Then, close and reopen the PowerShell console.
For more information about how to install PowerShell modules, see [Install the Azure PowerShell module](https://docs.microsoft.com/powershell/azure/install-az-ps?view=azps-3.0.0)
53
+
For more information about how to install PowerShell modules, see [Install the Azure PowerShell module](https://docs.microsoft.com/powershell/azure/install-az-ps?view=azps-3.0.0)
> Use the `-Force` parameter if you want to overwrite without prompts.
148
+
146
149
This example moves a directory named `my-directory` to a subdirectory of `my-directory-2` named `my-subdirectory`. This example also applies a umask to the subdirectory.
List the contents of a directory by using the `Get-AzDataLakeGen2ChildItem` cmdlet.
187
+
List the contents of a directory by using the `Get-AzDataLakeGen2ChildItem` cmdlet. You can use the optional parameter `-OutputUserPrincipalName` to get the name (instead of the object ID) of users.
185
188
186
189
This example lists the contents of a directory named `my-directory`.
This example doesn't return values for the `ACL`, `Permissions`, `Group`, and `Owner` properties. To obtain those values, use the `-FetchPermission` parameter.
197
+
This example doesn't return values for the `ACL`, `Permissions`, `Group`, and `Owner` properties. To obtain those values, use the `-FetchProperty` parameter.
195
198
196
-
The following example lists the contents of the same directory, but it also uses the `-FetchPermission` parameter to return values for the `ACL`, `Permissions`, `Group`, and `Owner` properties.
199
+
The following example lists the contents of the same directory, but it also uses the `-FetchProperty` parameter to return values for the `ACL`, `Permissions`, `Group`, and `Owner` properties.
@@ -263,15 +266,24 @@ You can use the `-Force` parameter to remove the file without a prompt.
263
266
264
267
## Manage access permissions
265
268
266
-
You can get, set, and update access permissions of directories and files.
269
+
You can get, set, and update access permissions of file systems, directories and files.
267
270
268
271
> [!NOTE]
269
272
> If you're using Azure Active Directory (Azure AD) to authorize commands, then make sure that your security principal has been assigned the [Storage Blob Data Owner role](https://docs.microsoft.com/azure/role-based-access-control/built-in-roles#storage-blob-data-owner). To learn more about how ACL permissions are applied and the effects of changing them, see [Access control in Azure Data Lake Storage Gen2](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-access-control).
270
273
271
-
### Get directory and file permissions
274
+
### Get permissions
272
275
273
276
Get the ACL of a directory or file by using the `Get-AzDataLakeGen2Item`cmdlet.
274
277
278
+
279
+
This example gets the ACL of a **file system** and then prints the ACL to the console.
This example gets the ACL of a **directory**, and then prints the ACL to the console.
276
288
277
289
```powershell
@@ -295,18 +307,30 @@ The following image shows the output after getting the ACL of a directory.
295
307
296
308
In this example, the owning user has read, write, and execute permissions. The owning group has only read and execute permissions. For more information about access control lists, see [Access control in Azure Data Lake Storage Gen2](data-lake-storage-access-control.md).
297
309
298
-
### Set directory and file permissions
310
+
### Set or update permissions
299
311
300
-
Use the `New-AzDataLakeGen2ItemAclObject` cmdlet to create an ACL for the owning user, owning group, or other users. Then, use the `Update-AzDataLakeGen2Item` cmdlet to commit the ACL.
312
+
Use the `set-AzDataLakeGen2ItemAclObject` cmdlet to create an ACL for the owning user, owning group, or other users. Then, use the `Update-AzDataLakeGen2Item` cmdlet to commit the ACL.
313
+
314
+
This example sets the ACL on a **file system** for the owning user, owning group, or other users, and then prints the ACL to the console.
315
+
316
+
```powershell
317
+
$filesystemName = "my-file-system"
318
+
$acl = set-AzDataLakeGen2ItemAclObject -AccessControlType user -Permission rw-
319
+
$acl = set-AzDataLakeGen2ItemAclObject -AccessControlType group -Permission rw- -InputObject $acl
320
+
$acl = set-AzDataLakeGen2ItemAclObject -AccessControlType other -Permission -wx -InputObject $acl
@@ -330,82 +354,17 @@ The following image shows the output after setting the ACL of a file.
330
354
331
355
In this example, the owning user and owning group have only read and write permissions. All other users have write and execute permissions. For more information about access control lists, see [Access control in Azure Data Lake Storage Gen2](data-lake-storage-access-control.md).
332
356
333
-
### Update directory and file permissions
334
-
335
-
Use the `Get-AzDataLakeGen2Item` cmdlet to get the ACL of a directory or file. Then, use the `New-AzDataLakeGen2ItemAclObject` cmdlet to create a new ACL entry. Use the `Update-AzDataLakeGen2Item` cmdlet to apply the new ACL.
336
-
337
-
This example gives a group write and execute permission on a directory.
You can use the `Get-AzDataLakeGen2Item` and the `-Recurse` parameter together with the `Update-AzDataLakeGen2Item` cmdlet to recursively to set the ACL of all directories and files in a file system.
402
361
403
362
```powershell
404
363
$filesystemName = "my-file-system"
405
-
$acl = New-AzDataLakeGen2ItemAclObject -AccessControlType user -Permission rw-
406
-
$acl = New-AzDataLakeGen2ItemAclObject -AccessControlType group -Permission rw- -InputObject $acl
407
-
$acl = New-AzDataLakeGen2ItemAclObject -AccessControlType other -Permission "-wx" -InputObject $acl
0 commit comments