azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzStorageFileHandle - Returns with error "An HTTP header that's mandatory for this request is not specified"

Open HenkAJV opened this issue 1 year ago • 1 comments

Description

I run the following Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive the following output. I would expect not to see any HTTP header request errors running the Powershell version.

Issue script & Debug output

Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive
DEBUG: 10:22:01 PM - Init Operation Context for 'GetAzureStorageFileHandle' with client request id  Azure-Storage-PowerShell-fdda8aaf-2075-429b-8a92-faad74daa94b. If you want to get more details, please add "-Debug" to your command.
DEBUG: 10:22:01 PM - GetAzureStorageFileHandle begin processing with ParameterSet 'ShareName'.
DEBUG: 10:22:01 PM - Use storage account 'steasternshare' from storage context.
DEBUG: Request [6ccfbbc4-6024-4afa-8bf3-9ae99dee22ac] GET https://steasternshare.file.core.windows.net/vmeasternshare?comp=listhandles
x-ms-recursive:true
x-ms-version:2023-08-03
x-ms-allow-trailing-dot:REDACTED
Accept:application/xml
User-Agent:AzurePowershell/v1.0.0,azsdk-net-Storage.Files.Shares/12.16.0 (.NET 8.0.1; Microsoft Windows 10.0.22631)
x-ms-client-request-id:6ccfbbc4-6024-4afa-8bf3-9ae99dee22ac
x-ms-return-client-request-id:true
Authorization:REDACTED
client assembly: Azure.Storage.Files.Shares
DEBUG: Error response [6ccfbbc4-6024-4afa-8bf3-9ae99dee22ac] 400 An HTTP header that's mandatory for this request is not specified. (00.2s)
Server:Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
x-ms-request-id:a60aee2d-b01a-0026-5834-5e32d3000000
x-ms-client-request-id:6ccfbbc4-6024-4afa-8bf3-9ae99dee22ac
x-ms-version:2023-08-03
x-ms-error-code:MissingRequiredHeader
Date:Tue, 13 Feb 2024 04:22:01 GMT
Content-Length:305
Content-Type:application/xml

Get-AzStorageFileHandle: An HTTP header that's mandatory for this request is not specified.
RequestId:a60aee2d-b01a-0026-5834-5e32d3000000
Time:2024-02-13T04:22:01.8181906Z
Status: 400 (An HTTP header that's mandatory for this request is not specified.)
ErrorCode: MissingRequiredHeader

Additional Information:
HeaderName: x-ms-file-request-intent

Content:
<?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP header that's mandatory for this request is not specified.
RequestId:a60aee2d-b01a-0026-5834-5e32d3000000
Time:2024-02-13T04:22:01.8181906Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

Headers:
Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
x-ms-request-id: a60aee2d-b01a-0026-5834-5e32d3000000
x-ms-client-request-id: 6ccfbbc4-6024-4afa-8bf3-9ae99dee22ac
x-ms-version: 2023-08-03
x-ms-error-code: MissingRequiredHeader
Date: Tue, 13 Feb 2024 04:22:01 GMT
Content-Length: 305
Content-Type: application/xml
DEBUG: 10:22:01 PM - GetAzureStorageFileHandle end processing, Start 0 remote calls. Finish 0 remote calls. Elapsed time 3096143.49 ms. Client operation id: Azure-Storage-PowerShell-fdda8aaf-2075-429b-8a92-faad74daa94b.
DEBUG: AzureQoSEvent:  Module: Az.Storage:6.1.1; CommandName: Get-AzStorageFileHandle; PSVersion: 7.4.1; IsSuccess: False; Duration: 00:00:00.2101708; Exception: An HTTP header that's mandatory for this request is not specified.
RequestId:a60aee2d-b01a-0026-5834-5e32d3000000
Time:2024-02-13T04:22:01.8181906Z
Status: 400 (An HTTP header that's mandatory for this request is not specified.)
ErrorCode: MissingRequiredHeader

Additional Information:
HeaderName: x-ms-file-request-intent

Content:
<?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP header that's mandatory for this request is not specified.
RequestId:a60aee2d-b01a-0026-5834-5e32d3000000
Time:2024-02-13T04:22:01.8181906Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

Headers:
Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
x-ms-request-id: a60aee2d-b01a-0026-5834-5e32d3000000
x-ms-client-request-id: 6ccfbbc4-6024-4afa-8bf3-9ae99dee22ac
x-ms-version: 2023-08-03
x-ms-error-code: MissingRequiredHeader
Date: Tue, 13 Feb 2024 04:22:01 GMT
Content-Length: 305
Content-Type: application/xml
;
DEBUG: 10:22:01 PM - GetAzureStorageFileHandle end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.15.1                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzConte…
Script     6.1.1                 Az.Storage                          {Add-AzRmStorageContainerLegalHold, Add-AzStorage…

Error output

DEBUG: 10:26:43 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 10:26:43 PM - using account id '[redacted]'...
DEBUG: 10:26:43 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 23

Message        : An HTTP header that's mandatory for this request is not specified.
                 RequestId:a60aee2d-b01a-0026-5834-5e32d3000000
                 Time:2024-02-13T04:22:01.8181906Z
                 Status: 400 (An HTTP header that's mandatory for this request is not specified.)
                 ErrorCode: MissingRequiredHeader

                 Additional Information:
                 HeaderName: x-ms-file-request-intent

                 Content:
                 <?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP
                 header that's mandatory for this request is not specified.
                 RequestId:a60aee2d-b01a-0026-5834-5e32d3000000
                 Time:2024-02-13T04:22:01.8181906Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

                 Headers:
                 Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
                 x-ms-request-id: a60aee2d-b01a-0026-5834-5e32d3000000
                 x-ms-client-request-id: 6ccfbbc4-6024-4afa-8bf3-9ae99dee22ac
                 x-ms-version: 2023-08-03
                 x-ms-error-code: MissingRequiredHeader
                 Date: Tue, 13 Feb 2024 04:22:01 GMT
                 Content-Length: 305
                 Content-Type: application/xml

StackTrace     :    at Azure.Storage.Files.Shares.DirectoryRestClient.ListHandles(String marker, Nullable`1
                 maxresults, Nullable`1 timeout, String sharesnapshot, Nullable`1 recursive, CancellationToken
                 cancellationToken)
                    at Azure.Storage.Files.Shares.ShareDirectoryClient.GetHandlesInternal(String marker, Nullable`1
                 maxResults, Nullable`1 recursive, Boolean async, CancellationToken cancellationToken)
                    at Azure.Storage.Files.Shares.Models.GetDirectoryHandlesAsyncCollection.GetNextPageAsync(String
                 continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
                    at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
                    at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.AsPages(String continuationToken,
                 Nullable`1 pageHintSize)+MoveNext()
                    at Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Azure.RequestFailedException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive
Position       : At line:1 char:1
                 + Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Con …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 23


   HistoryId: 21

Message        : An HTTP header that's mandatory for this request is not specified.
                 RequestId:39ed4d83-a01a-0010-7c33-5e9f81000000
                 Time:2024-02-13T04:16:24.9125713Z
                 Status: 400 (An HTTP header that's mandatory for this request is not specified.)
                 ErrorCode: MissingRequiredHeader

                 Additional Information:
                 HeaderName: x-ms-file-request-intent

                 Content:
                 <?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP
                 header that's mandatory for this request is not specified.
                 RequestId:39ed4d83-a01a-0010-7c33-5e9f81000000
                 Time:2024-02-13T04:16:24.9125713Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

                 Headers:
                 Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
                 x-ms-request-id: 39ed4d83-a01a-0010-7c33-5e9f81000000
                 x-ms-client-request-id: dfda6270-5f72-475c-9c06-81e806e641fb
                 x-ms-version: 2023-08-03
                 x-ms-error-code: MissingRequiredHeader
                 Date: Tue, 13 Feb 2024 04:16:24 GMT
                 Content-Length: 305
                 Content-Type: application/xml

StackTrace     :    at Azure.Storage.Files.Shares.DirectoryRestClient.ListHandles(String marker, Nullable`1
                 maxresults, Nullable`1 timeout, String sharesnapshot, Nullable`1 recursive, CancellationToken
                 cancellationToken)
                    at Azure.Storage.Files.Shares.ShareDirectoryClient.GetHandlesInternal(String marker, Nullable`1
                 maxResults, Nullable`1 recursive, Boolean async, CancellationToken cancellationToken)
                    at Azure.Storage.Files.Shares.Models.GetDirectoryHandlesAsyncCollection.GetNextPageAsync(String
                 continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
                    at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
                    at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.AsPages(String continuationToken,
                 Nullable`1 pageHintSize)+MoveNext()
                    at Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Azure.RequestFailedException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive
Position       : At line:1 char:1
                 + Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Con …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 21


   HistoryId: 15

Message        : The term 'Version' is not recognized as a name of a cmdlet, function, script file, or executable
                 program.
                 Check the spelling of the name, or if a path was included, verify that the path is correct and try
                 again.
StackTrace     :    at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName,
                 CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin
                 commandOrigin, ExecutionContext context)
                    at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe,
                 CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[]
                 redirections, ExecutionContext context)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
                 CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
                 commandRedirections, FunctionContext funcContext)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                 frame)
Exception      : System.Management.Automation.CommandNotFoundException
InvocationInfo : {}
Line           : Version    Name                                Type       Repository     Description
Position       : At line:1 char:1
                 + Version    Name                                Type       Repository  …
                 + ~~~~~~~
HistoryId      : 15


   HistoryId: 12

Message        : An HTTP header that's mandatory for this request is not specified.
                 RequestId:1bf7e8cc-801a-002e-772d-5e29a0000000
                 Time:2024-02-13T03:34:02.5339433Z
                 Status: 400 (An HTTP header that's mandatory for this request is not specified.)
                 ErrorCode: MissingRequiredHeader

                 Additional Information:
                 HeaderName: x-ms-file-request-intent

                 Content:
                 <?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP
                 header that's mandatory for this request is not specified.
                 RequestId:1bf7e8cc-801a-002e-772d-5e29a0000000
                 Time:2024-02-13T03:34:02.5339433Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

                 Headers:
                 Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
                 x-ms-request-id: 1bf7e8cc-801a-002e-772d-5e29a0000000
                 x-ms-client-request-id: 6dd5db2c-64f5-4907-bf27-c0bdca695c05
                 x-ms-version: 2023-08-03
                 x-ms-error-code: MissingRequiredHeader
                 Date: Tue, 13 Feb 2024 03:34:01 GMT
                 Content-Length: 305
                 Content-Type: application/xml

StackTrace     :    at Azure.Storage.Files.Shares.DirectoryRestClient.ListHandles(String marker, Nullable`1
                 maxresults, Nullable`1 timeout, String sharesnapshot, Nullable`1 recursive, CancellationToken
                 cancellationToken)
                    at Azure.Storage.Files.Shares.ShareDirectoryClient.GetHandlesInternal(String marker, Nullable`1
                 maxResults, Nullable`1 recursive, Boolean async, CancellationToken cancellationToken)
                    at Azure.Storage.Files.Shares.Models.GetDirectoryHandlesAsyncCollection.GetNextPageAsync(String
                 continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
                    at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
                    at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.AsPages(String continuationToken,
                 Nullable`1 pageHintSize)+MoveNext()
                    at Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Azure.RequestFailedException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive
Position       : At line:1 char:1
                 + Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Con …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 12


   HistoryId: 11

Message        : Missing an argument for parameter 'DefaultProfile'. Specify a parameter of type
                 'Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer' and try
                 again.
StackTrace     :    at System.Management.Automation.ParameterBinderController.ReparseUnboundArguments()
                    at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidati
                 on(Collection`1 arguments)
                    at
                 System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1
                 arguments)
                    at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
                    at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
                    at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary
                 psDefaultParameterValues)
                    at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
                    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
                 input)
                 --- End of stack trace from previous location ---
                    at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
                 input)
                    at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
                 CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
                 commandRedirections, FunctionContext funcContext)
                    at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                 frame)
Exception      : System.Management.Automation.ParameterBindingException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive -DefaultProfile
Position       : At line:1 char:86
                 + … ame "vmeasternshare" -Context $ctx.Context -Recursive -DefaultProfile
                 +                                                         ~~~~~~~~~~~~~~~
HistoryId      : 11


   HistoryId: 10

Message        : An HTTP header that's mandatory for this request is not specified.
                 RequestId:095c7593-301a-001e-1e2d-5e738a000000
                 Time:2024-02-13T03:32:00.0904975Z
                 Status: 400 (An HTTP header that's mandatory for this request is not specified.)
                 ErrorCode: MissingRequiredHeader

                 Additional Information:
                 HeaderName: x-ms-file-request-intent

                 Content:
                 <?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP
                 header that's mandatory for this request is not specified.
                 RequestId:095c7593-301a-001e-1e2d-5e738a000000
                 Time:2024-02-13T03:32:00.0904975Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

                 Headers:
                 Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
                 x-ms-request-id: 095c7593-301a-001e-1e2d-5e738a000000
                 x-ms-client-request-id: db67430e-188d-43c1-bb2f-cd1ea727df65
                 x-ms-version: 2023-08-03
                 x-ms-error-code: MissingRequiredHeader
                 Date: Tue, 13 Feb 2024 03:31:59 GMT
                 Content-Length: 305
                 Content-Type: application/xml

StackTrace     :    at Azure.Storage.Files.Shares.DirectoryRestClient.ListHandles(String marker, Nullable`1
                 maxresults, Nullable`1 timeout, String sharesnapshot, Nullable`1 recursive, CancellationToken
                 cancellationToken)
                    at Azure.Storage.Files.Shares.ShareDirectoryClient.GetHandlesInternal(String marker, Nullable`1
                 maxResults, Nullable`1 recursive, Boolean async, CancellationToken cancellationToken)
                    at Azure.Storage.Files.Shares.Models.GetDirectoryHandlesAsyncCollection.GetNextPageAsync(String
                 continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
                    at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
                    at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.AsPages(String continuationToken,
                 Nullable`1 pageHintSize)+MoveNext()
                    at Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Azure.RequestFailedException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive
Position       : At line:1 char:1
                 + Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Con …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 10


   HistoryId: 8

Message        : An HTTP header that's mandatory for this request is not specified.
                 RequestId:095c753f-301a-001e-0c2d-5e738a000000
                 Time:2024-02-13T03:31:40.8846276Z
                 Status: 400 (An HTTP header that's mandatory for this request is not specified.)
                 ErrorCode: MissingRequiredHeader

                 Additional Information:
                 HeaderName: x-ms-file-request-intent

                 Content:
                 <?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP
                 header that's mandatory for this request is not specified.
                 RequestId:095c753f-301a-001e-0c2d-5e738a000000
                 Time:2024-02-13T03:31:40.8846276Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

                 Headers:
                 Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
                 x-ms-request-id: 095c753f-301a-001e-0c2d-5e738a000000
                 x-ms-client-request-id: b8efeaa7-30e7-46ca-8aa3-f634a43f13dd
                 x-ms-version: 2023-08-03
                 x-ms-error-code: MissingRequiredHeader
                 Date: Tue, 13 Feb 2024 03:31:40 GMT
                 Content-Length: 305
                 Content-Type: application/xml

StackTrace     :    at Azure.Storage.Files.Shares.DirectoryRestClient.ListHandles(String marker, Nullable`1
                 maxresults, Nullable`1 timeout, String sharesnapshot, Nullable`1 recursive, CancellationToken
                 cancellationToken)
                    at Azure.Storage.Files.Shares.ShareDirectoryClient.GetHandlesInternal(String marker, Nullable`1
                 maxResults, Nullable`1 recursive, Boolean async, CancellationToken cancellationToken)
                    at Azure.Storage.Files.Shares.Models.GetDirectoryHandlesAsyncCollection.GetNextPageAsync(String
                 continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
                    at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
                    at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.AsPages(String continuationToken,
                 Nullable`1 pageHintSize)+MoveNext()
                    at Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Azure.RequestFailedException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Context -Recursive
Position       : At line:1 char:1
                 + Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx.Con …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 8


   HistoryId: 7

Message        : An HTTP header that's mandatory for this request is not specified.
                 RequestId:095c74a5-301a-001e-682d-5e738a000000
                 Time:2024-02-13T03:30:55.1480935Z
                 Status: 400 (An HTTP header that's mandatory for this request is not specified.)
                 ErrorCode: MissingRequiredHeader

                 Additional Information:
                 HeaderName: x-ms-file-request-intent

                 Content:
                 <?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP
                 header that's mandatory for this request is not specified.
                 RequestId:095c74a5-301a-001e-682d-5e738a000000
                 Time:2024-02-13T03:30:55.1480935Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

                 Headers:
                 Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
                 x-ms-request-id: 095c74a5-301a-001e-682d-5e738a000000
                 x-ms-client-request-id: 754800c9-cf19-49dd-9e02-92365eb9c71f
                 x-ms-version: 2023-08-03
                 x-ms-error-code: MissingRequiredHeader
                 Date: Tue, 13 Feb 2024 03:30:54 GMT
                 Content-Length: 305
                 Content-Type: application/xml

StackTrace     :    at Azure.Storage.Files.Shares.DirectoryRestClient.ListHandles(String marker, Nullable`1
                 maxresults, Nullable`1 timeout, String sharesnapshot, Nullable`1 recursive, CancellationToken
                 cancellationToken)
                    at Azure.Storage.Files.Shares.ShareDirectoryClient.GetHandlesInternal(String marker, Nullable`1
                 maxResults, Nullable`1 recursive, Boolean async, CancellationToken cancellationToken)
                    at Azure.Storage.Files.Shares.Models.GetDirectoryHandlesAsyncCollection.GetNextPageAsync(String
                 continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
                    at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
                    at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.AsPages(String continuationToken,
                 Nullable`1 pageHintSize)+MoveNext()
                    at Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Azure.RequestFailedException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx -Recursive
Position       : At line:1 char:1
                 + Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx -Re …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 7


   HistoryId: 6

Message        : An HTTP header that's mandatory for this request is not specified.
                 RequestId:095c7435-301a-001e-4f2c-5e738a000000
                 Time:2024-02-13T03:30:25.9430040Z
                 Status: 400 (An HTTP header that's mandatory for this request is not specified.)
                 ErrorCode: MissingRequiredHeader

                 Additional Information:
                 HeaderName: x-ms-file-request-intent

                 Content:
                 <?xml version="1.0" encoding="utf-8"?><Error><Code>MissingRequiredHeader</Code><Message>An HTTP
                 header that's mandatory for this request is not specified.
                 RequestId:095c7435-301a-001e-4f2c-5e738a000000
                 Time:2024-02-13T03:30:25.9430040Z</Message><HeaderName>x-ms-file-request-intent</HeaderName></Error>

                 Headers:
                 Server: Windows-Azure-File/1.0,Microsoft-HTTPAPI/2.0
                 x-ms-request-id: 095c7435-301a-001e-4f2c-5e738a000000
                 x-ms-client-request-id: 797a3f8a-ac1a-4669-bf40-bf7ff051e85b
                 x-ms-version: 2023-08-03
                 x-ms-error-code: MissingRequiredHeader
                 Date: Tue, 13 Feb 2024 03:30:25 GMT
                 Content-Length: 305
                 Content-Type: application/xml

StackTrace     :    at Azure.Storage.Files.Shares.DirectoryRestClient.ListHandles(String marker, Nullable`1
                 maxresults, Nullable`1 timeout, String sharesnapshot, Nullable`1 recursive, CancellationToken
                 cancellationToken)
                    at Azure.Storage.Files.Shares.ShareDirectoryClient.GetHandlesInternal(String marker, Nullable`1
                 maxResults, Nullable`1 recursive, Boolean async, CancellationToken cancellationToken)
                    at Azure.Storage.Files.Shares.Models.GetDirectoryHandlesAsyncCollection.GetNextPageAsync(String
                 continuationToken, Nullable`1 pageSizeHint, Boolean async, CancellationToken cancellationToken)
                    at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](ValueTask`1 task)
                    at Azure.Storage.StorageCollectionEnumerator`1.StoragePageable.AsPages(String continuationToken,
                 Nullable`1 pageHintSize)+MoveNext()
                    at Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFileHandle.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>b__3_0(T c)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet, Action`1 executor)
                    at
                 Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
                 cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Azure.RequestFailedException
InvocationInfo : {Get-AzStorageFileHandle}
Line           : Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx
Position       : At line:1 char:1
                 + Get-AzStorageFileHandle -ShareName "vmeasternshare" -Context $ctx
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 6



DEBUG: 10:26:43 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:26:43 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.15.1; CommandName: Resolve-AzError; PSVersion: 7.4.1; IsSuccess: True; Duration: 00:00:00.1445338
DEBUG: 10:26:43 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 10:26:43 PM - ResolveError end processing.

HenkAJV avatar Feb 13 '24 04:02 HenkAJV

@HenkAJV

From the error message , you can see the missing hearder is "x-ms-file-request-intent". This header is required when use OAuth authentication on Azure File API.

To add the header, you need create Storage Context by "New-AzStorageContext" with parameter "-EnableFileBackupRequestIntent" like example.

You can find more details for this header in https://learn.microsoft.com/en-us/rest/api/storageservices/list-handles#:~:text=x%2Dms%2Dfile%2Drequest%2Dintent

Please note, the header is required to use Oauth on Azure File API. And for security consideration, user need specify the related parameter "-EnableFileBackupRequestIntent" explicitly in create storage context with "New-AzStorageContext". (And we can't make this parameter as required, since the created storage context can be used in other service like Blob, and this header is not required in other service.)

blueww avatar Feb 16 '24 06:02 blueww

Thank you for the reply. I added the -EnableFileBackupRequestIntent for New-AzStorageContext and no longer get the header error. I do get authorization errors when I run Get-AzStorageFileHandle, even though I am an admin on the tenant. I will need to figure out the authorization error to figure out why.

HenkAJV avatar Feb 19 '24 01:02 HenkAJV

@HenkAJV

Please note, you will need 'Storage File Data Privileged Reader' or 'Storage File Data Privileged Contributor' roles to call the Files REST Data API using OAuth, even you are an admin (owner role) on the tenant.

You can find more details for File Oauth in: https://learn.microsoft.com/en-us/azure/storage/files/authorize-oauth-rest?tabs=portal#privileged-access-and-access-permissions-for-data-operations

blueww avatar Feb 19 '24 01:02 blueww

Okay, I got it working, using -StorageAccountKey instead of the -ConnectedAccount. That solved my issue and I can see the handles now. I will close the ticket. Thank you for all the help and input.

HenkAJV avatar Feb 19 '24 01:02 HenkAJV