我试图使用powershell在Azure AZDataLakeStoreItem 1中创建一些新文件夹,但是和AzureRmDataLakeStoreItem都返回错误。
我对整个ADLS都有RWX权限,我有PS版本。
重大小版本修改
5 1 17134 590
当我跑的时候
Test-AzDataLakeStoreAccount -Name "weudevpocdtl" 我得到了真正的回应。
但是,当我运行时:
New-AZDataLakeStoreItem -Account "weudevpocdtl" -Path "/PowerShellTest" -Folder我知道错误:
New-AZDataLakeStoreItem : Error in getting metadata for path /PowerShellTest.
Operation: GETFILESTATUS failed with Unknown Error: The 'User-Agent' header must be modified using the appropriate property or method.
Parameter name: name Source: System StackTrace: at System.Net.WebHeaderCollection.ThrowOnRestrictedHeader(String headerName)
at System.Net.WebHeaderCollection.Set(String name, String value)
at Microsoft.Azure.DataLake.Store.WebTransport.AssignCommonHttpHeaders(HttpWebRequest webReq, AdlsClient client, RequestOptions req, String token, String opMethod, IDictionary`2
customHeaders, Int32 postRequestLength)
at Microsoft.Azure.DataLake.Store.WebTransport.<MakeSingleCallAsync>d__22.MoveNext().
.
Last encountered exception thrown after 5 tries. [The 'User-Agent' header must be modified using the appropriate property or method.
Parameter name: name,The 'User-Agent' header must be modified using the appropriate property or method.
Parameter name: name,The 'User-Agent' header must be modified using the appropriate property or method.
Parameter name: name,The 'User-Agent' header must be modified using the appropriate property or method.
Parameter name: name,The 'User-Agent' header must be modified using the appropriate property or method.
Parameter name: name]
[ServerRequestId:]
At line:1 char:1
+ New-AZDataLakeStoreItem -Account "weudevpocdtl" -Path "/PowerS ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzDataLakeStoreItem], AdlsException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeStore.NewAzureDataLakeStoreItem当我跑的时候
New-AzureRmDataLakeStoreItem -Account "weudevpocdtl" -Path "/PowerShellTest" -Folder我得到了错误:
New-AzureRmDataLakeStoreItem : Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly
'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
At line:1 char:1
+ New-AzureRmDataLakeStoreItem -Account "weunappocdtl" -Path "/P ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmDataLakeStoreItem], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Azure.Commands.DataLakeStore.NewAzureDataLakeStoreItem在另一个租户上,我曾经能够执行这些命令,而且所有这些命令都能工作。
我做错了什么?
谢谢你的帮助
发布于 2019-04-04 09:40:17
根据Data,请参阅链接- -这是我们SDK使用的Httpwebrequest类的一个问题。在netframework和netcore之间,为httpwebrequest设置用户代理是不同的:
NET framework: webReq.UserAgent = client.GetUserAgent();
net standard webReq.Headers["User-Agent"] = client.GetUserAgent()如果您试图在.NET框架中稍后进行操作,则会得到上面所述的错误。
当您使用这个az模块时,它使用的是我们SDK的netstandard。当您在windows中使用它时,它试图在netframework上使用.NET标准dll,从而产生此错误。
解决方案:
我在net中测试了这一点。运行的很好。我们正在从httpwebrequest转向httpclient,这可能会解决这个问题。
因此,基本上,如果您使用的是,请使用azurerm,或者使用powershell netcore中的Az。
报告了同样的错误,下面是GitHub已知问题的链接。
https://github.com/Azure/azure-powershell/issues/8141
我建议你使用Powershell核心,https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-6
它应该会起作用的。
Get-AzureRmDataLakeStoreItem -Account "AccountName" -Path "/"
New-AzureRmDataLakeStoreItem -Account "AccountName" -Path "/Staging" -Folderhttps://stackoverflow.com/questions/55423524
复制相似问题