Skip to content

Commit 07aebc5

Browse files
authored
[Storage] Support File Oauth GA (#22275)
* [Storage] Support File Oauth * Update ChangeLog.md
1 parent a793625 commit 07aebc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3650
-259
lines changed

src/Storage/Storage.Management.Test/ScenarioTests/StorageBlobTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ function Test-StorageBlobContainerLegalHold
282282
Assert-AreNotEqual $null $container.LegalHold.Tags[0].Timestamp
283283
Assert-AreNotEqual $null $container.LegalHold.Tags[0].ObjectIdentifier
284284

285-
Add-AzRmStorageContainerLegalHold -ResourceGroupName $rgname -StorageAccountName $stoname -Name $containerName -Tag tag1
285+
$stos | Add-AzRmStorageContainerLegalHold -Name $containerName -Tag tag1
286286
$container = Get-AzRmStorageContainer -ResourceGroupName $rgname -StorageAccountName $stoname -Name $containerName
287287
Assert-AreEqual $containerName $container.Name
288288
Assert-AreEqual 2 $container.LegalHold.Tags.Count
@@ -293,7 +293,7 @@ function Test-StorageBlobContainerLegalHold
293293
Assert-AreNotEqual $null $container.LegalHold.Tags[1].Timestamp
294294
Assert-AreNotEqual $null $container.LegalHold.Tags[1].ObjectIdentifier
295295

296-
Remove-AzRmStorageContainerLegalHold -ResourceGroupName $rgname -StorageAccountName $stoname -Name $containerName -Tag tag1,tag3
296+
$stos | Remove-AzRmStorageContainerLegalHold -Name $containerName -Tag tag1,tag3
297297
$container = Get-AzRmStorageContainer -ResourceGroupName $rgname -StorageAccountName $stoname -Name $containerName
298298
Assert-AreEqual $containerName $container.Name
299299
Assert-AreEqual 0 $container.LegalHold.Tags.Count

src/Storage/Storage.Management/ChangeLog.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Supported OAuth authentication on File service cmdlets
22+
- `New-AzStorageContext`
23+
- `Get-AzStorageFile`
24+
- `Get-AzStorageFileContent`
25+
- `Get-AzStorageFileCopyState`
26+
- `New-AzStorageDirectory`
27+
- `Remove-AzStorageDirectory`
28+
- `Remove-AzStorageFile`
29+
- `Set-AzStorageFileContent`
30+
- `Start-AzStorageFileCopy`
31+
- `Stop-AzStorageFileCopy`
32+
- `Get-AzStorageFileHandle`
33+
- `Close-AzStorageFileHandle`
34+
* Supported get a file share object without get share properties. For pipeline to file/directory cmdlets with OAuth authentication.
35+
- `Get-AzStorageShare`
2136

2237
## Version 5.8.0
2338
* Supported TierToCold and TierToHot in Storage account management policy

src/Storage/Storage.Management/help/Close-AzStorageFileHandle.md

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,32 @@ Close-AzStorageFileHandle [-ShareName] <String> -FileHandle <PSFileHandle> [-Con
3030

3131
### ShareCloseAll
3232
```
33-
Close-AzStorageFileHandle [-Share] <CloudFileShare> [[-Path] <String>] [-Recursive] [-CloseAll] [-PassThru]
34-
[-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
35-
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
36-
[<CommonParameters>]
33+
Close-AzStorageFileHandle [-Share] <CloudFileShare> [-ShareClient <ShareClient>] [[-Path] <String>]
34+
[-Recursive] [-CloseAll] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>]
35+
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
36+
[-WhatIf] [-Confirm] [<CommonParameters>]
3737
```
3838

3939
### ShareCloseSingle
4040
```
41-
Close-AzStorageFileHandle [-Share] <CloudFileShare> -FileHandle <PSFileHandle> [-PassThru] [-AsJob]
42-
[-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
41+
Close-AzStorageFileHandle [-Share] <CloudFileShare> [-ShareClient <ShareClient>] -FileHandle <PSFileHandle>
42+
[-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
4343
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
4444
[<CommonParameters>]
4545
```
4646

4747
### DirectoryCloseAll
4848
```
49-
Close-AzStorageFileHandle [-Directory] <CloudFileDirectory> [[-Path] <String>] [-Recursive] [-CloseAll]
50-
[-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
51-
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
52-
[<CommonParameters>]
49+
Close-AzStorageFileHandle [-Directory] <CloudFileDirectory> [-ShareDirectoryClient <ShareDirectoryClient>]
50+
[[-Path] <String>] [-Recursive] [-CloseAll] [-PassThru] [-AsJob] [-ServerTimeoutPerRequest <Int32>]
51+
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
52+
[-WhatIf] [-Confirm] [<CommonParameters>]
5353
```
5454

5555
### FileCloseAll
5656
```
57-
Close-AzStorageFileHandle [-File] <CloudFile> [-CloseAll] [-PassThru] [-AsJob]
58-
[-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
57+
Close-AzStorageFileHandle [-File] <CloudFile> [-ShareFileClient <ShareFileClient>] [-CloseAll] [-PassThru]
58+
[-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
5959
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
6060
[<CommonParameters>]
6161
```
@@ -83,13 +83,14 @@ This command lists all file handles on a file directory recursively, filters out
8383
```powershell
8484
Close-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2' -Recursive -CloseAll -PassThru
8585
```
86+
8687
```output
8788
10
8889
```
8990

9091
This command closes all file handles on a file directory and shows the closed file handle count.
9192

92-
### Example 4: Close all file handles on a file share
93+
### Example 4: Close all file handles on a file share
9394
```powershell
9495
Close-AzStorageFileHandle -ShareName "mysharename" -CloseAll -Recursive
9596
```
@@ -310,6 +311,51 @@ Accept pipeline input: True (ByPropertyName, ByValue)
310311
Accept wildcard characters: False
311312
```
312313
314+
### -ShareClient
315+
ShareClient object indicated the share which contains the files/directories to closed handle.
316+
317+
```yaml
318+
Type: Azure.Storage.Files.Shares.ShareClient
319+
Parameter Sets: ShareCloseAll, ShareCloseSingle
320+
Aliases:
321+
322+
Required: False
323+
Position: Named
324+
Default value: None
325+
Accept pipeline input: True (ByPropertyName, ByValue)
326+
Accept wildcard characters: False
327+
```
328+
329+
### -ShareDirectoryClient
330+
ShareDirectoryClient object indicated the base folder which contains the files/directories to closed handle.
331+
332+
```yaml
333+
Type: Azure.Storage.Files.Shares.ShareDirectoryClient
334+
Parameter Sets: DirectoryCloseAll
335+
Aliases:
336+
337+
Required: False
338+
Position: Named
339+
Default value: None
340+
Accept pipeline input: True (ByPropertyName, ByValue)
341+
Accept wildcard characters: False
342+
```
343+
344+
### -ShareFileClient
345+
ShareFileClient object indicated the file to close handle.
346+
347+
```yaml
348+
Type: Azure.Storage.Files.Shares.ShareFileClient
349+
Parameter Sets: FileCloseAll
350+
Aliases:
351+
352+
Required: False
353+
Position: Named
354+
Default value: None
355+
Accept pipeline input: True (ByPropertyName, ByValue)
356+
Accept wildcard characters: False
357+
```
358+
313359
### -ShareName
314360
Name of the file share where the files/directories would be listed.
315361
@@ -357,7 +403,7 @@ Accept wildcard characters: False
357403
```
358404
359405
### CommonParameters
360-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
406+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
361407
362408
## INPUTS
363409

src/Storage/Storage.Management/help/Get-AzStorageFile.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ Get-AzStorageFile [-ShareName] <String> [[-Path] <String>] [-ExcludeExtendedInfo
2222

2323
### Share
2424
```
25-
Get-AzStorageFile [-Share] <CloudFileShare> [[-Path] <String>] [-ExcludeExtendedInfo]
26-
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
27-
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>]
25+
Get-AzStorageFile [-Share] <CloudFileShare> [-ShareClient <ShareClient>] [[-Path] <String>]
26+
[-ExcludeExtendedInfo] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
27+
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
28+
[<CommonParameters>]
2829
```
2930

3031
### Directory
3132
```
32-
Get-AzStorageFile [-Directory] <CloudFileDirectory> [[-Path] <String>] [-ExcludeExtendedInfo]
33-
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
34-
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>]
33+
Get-AzStorageFile [-Directory] <CloudFileDirectory> [-ShareDirectoryClient <ShareDirectoryClient>]
34+
[[-Path] <String>] [-ExcludeExtendedInfo] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
35+
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
36+
[<CommonParameters>]
3537
```
3638

3739
## DESCRIPTION
@@ -212,6 +214,36 @@ Accept pipeline input: True (ByPropertyName, ByValue)
212214
Accept wildcard characters: False
213215
```
214216
217+
### -ShareClient
218+
ShareClient object indicated the share where the files/directories would be listed.
219+
220+
```yaml
221+
Type: Azure.Storage.Files.Shares.ShareClient
222+
Parameter Sets: Share
223+
Aliases:
224+
225+
Required: False
226+
Position: Named
227+
Default value: None
228+
Accept pipeline input: True (ByPropertyName, ByValue)
229+
Accept wildcard characters: False
230+
```
231+
232+
### -ShareDirectoryClient
233+
ShareDirectoryClient object indicated the base folder where the files/directories would be listed.
234+
235+
```yaml
236+
Type: Azure.Storage.Files.Shares.ShareDirectoryClient
237+
Parameter Sets: Directory
238+
Aliases:
239+
240+
Required: False
241+
Position: Named
242+
Default value: None
243+
Accept pipeline input: True (ByPropertyName, ByValue)
244+
Accept wildcard characters: False
245+
```
246+
215247
### -ShareName
216248
Specifies the name of the file share.
217249
This cmdlet gets a file or directory from the file share that this parameter specifies.

src/Storage/Storage.Management/help/Get-AzStorageFileContent.md

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,28 @@ Get-AzStorageFileContent [-ShareName] <String> [-Path] <String> [[-Destination]
2323

2424
### Share
2525
```
26-
Get-AzStorageFileContent [-Share] <CloudFileShare> [-Path] <String> [[-Destination] <String>] [-CheckMd5]
27-
[-PassThru] [-Force] [-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
26+
Get-AzStorageFileContent [-Share] <CloudFileShare> [-ShareClient <ShareClient>] [-Path] <String>
27+
[[-Destination] <String>] [-CheckMd5] [-PassThru] [-Force] [-AsJob] [-Context <IStorageContext>]
28+
[-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
2829
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
2930
[-PreserveSMBAttribute] [<CommonParameters>]
3031
```
3132

3233
### Directory
3334
```
34-
Get-AzStorageFileContent [-Directory] <CloudFileDirectory> [-Path] <String> [[-Destination] <String>]
35-
[-CheckMd5] [-PassThru] [-Force] [-AsJob] [-ServerTimeoutPerRequest <Int32>]
36-
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
37-
[-WhatIf] [-Confirm] [-PreserveSMBAttribute] [<CommonParameters>]
35+
Get-AzStorageFileContent [-Directory] <CloudFileDirectory> [-ShareDirectoryClient <ShareDirectoryClient>]
36+
[-Path] <String> [[-Destination] <String>] [-CheckMd5] [-PassThru] [-Force] [-AsJob]
37+
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
38+
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
39+
[-PreserveSMBAttribute] [<CommonParameters>]
3840
```
3941

4042
### File
4143
```
42-
Get-AzStorageFileContent [-File] <CloudFile> [[-Destination] <String>] [-CheckMd5] [-PassThru] [-Force]
43-
[-AsJob] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
44-
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [-WhatIf] [-Confirm]
45-
[-PreserveSMBAttribute] [<CommonParameters>]
44+
Get-AzStorageFileContent [-File] <CloudFile> [-ShareFileClient <ShareFileClient>] [[-Destination] <String>]
45+
[-CheckMd5] [-PassThru] [-Force] [-AsJob] [-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>]
46+
[-ClientTimeoutPerRequest <Int32>] [-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>]
47+
[-WhatIf] [-Confirm] [-PreserveSMBAttribute] [<CommonParameters>]
4648
```
4749

4850
## DESCRIPTION
@@ -139,7 +141,7 @@ Specifies an Azure Storage context. To obtain a context, use the New-AzStorageCo
139141
140142
```yaml
141143
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext
142-
Parameter Sets: ShareName
144+
Parameter Sets: (All)
143145
Aliases:
144146

145147
Required: False
@@ -318,6 +320,51 @@ Accept pipeline input: True (ByPropertyName, ByValue)
318320
Accept wildcard characters: False
319321
```
320322
323+
### -ShareClient
324+
CloudFileShare object indicated the share where the file would be downloaded.
325+
326+
```yaml
327+
Type: Azure.Storage.Files.Shares.ShareClient
328+
Parameter Sets: Share
329+
Aliases:
330+
331+
Required: False
332+
Position: Named
333+
Default value: None
334+
Accept pipeline input: True (ByPropertyName, ByValue)
335+
Accept wildcard characters: False
336+
```
337+
338+
### -ShareDirectoryClient
339+
ShareDirectoryClient object indicated the cloud directory where the file would be downloaded.
340+
341+
```yaml
342+
Type: Azure.Storage.Files.Shares.ShareDirectoryClient
343+
Parameter Sets: Directory
344+
Aliases:
345+
346+
Required: False
347+
Position: Named
348+
Default value: None
349+
Accept pipeline input: True (ByPropertyName, ByValue)
350+
Accept wildcard characters: False
351+
```
352+
353+
### -ShareFileClient
354+
ShareFileClient object indicated the cloud file to be downloaded.
355+
356+
```yaml
357+
Type: Azure.Storage.Files.Shares.ShareFileClient
358+
Parameter Sets: File
359+
Aliases:
360+
361+
Required: False
362+
Position: Named
363+
Default value: None
364+
Accept pipeline input: True (ByPropertyName, ByValue)
365+
Accept wildcard characters: False
366+
```
367+
321368
### -ShareName
322369
Specifies the name of the file share.
323370
This cmdlet downloads the contents of the file in the share this parameter specifies.
@@ -366,7 +413,7 @@ Accept wildcard characters: False
366413
```
367414
368415
### CommonParameters
369-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
416+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
370417
371418
## INPUTS
372419

src/Storage/Storage.Management/help/Get-AzStorageFileCopyState.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Get-AzStorageFileCopyState [-ShareName] <String> [-FilePath] <String> [-WaitForC
2222

2323
### File
2424
```
25-
Get-AzStorageFileCopyState [-File] <CloudFile> [-WaitForComplete] [-Context <IStorageContext>]
26-
[-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
25+
Get-AzStorageFileCopyState [-File] <CloudFile> [-ShareFileClient <ShareFileClient>] [-WaitForComplete]
26+
[-Context <IStorageContext>] [-ServerTimeoutPerRequest <Int32>] [-ClientTimeoutPerRequest <Int32>]
2727
[-DefaultProfile <IAzureContextContainer>] [-ConcurrentTaskCount <Int32>] [<CommonParameters>]
2828
```
2929

@@ -165,6 +165,21 @@ Accept pipeline input: False
165165
Accept wildcard characters: False
166166
```
167167
168+
### -ShareFileClient
169+
ShareFileClient object indicated the file to get copy status.
170+
171+
```yaml
172+
Type: Azure.Storage.Files.Shares.ShareFileClient
173+
Parameter Sets: File
174+
Aliases:
175+
176+
Required: False
177+
Position: Named
178+
Default value: None
179+
Accept pipeline input: True (ByPropertyName, ByValue)
180+
Accept wildcard characters: False
181+
```
182+
168183
### -ShareName
169184
Specifies the name of a share.
170185

0 commit comments

Comments
 (0)