通过Powershell访问Azure Datalake存储 [英] Accessing Azure Datalake store through powershell

查看:56
本文介绍了通过Powershell访问Azure Datalake存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下命令访问datalake文件夹中的文件:

I am trying to access the files in datalake folder with command:

Get-AzureRmDataLakeStoreChildItem -AccountName $ dataLakeStorageGen1Name -Path $ myrootdir

Get-AzureRmDataLakeStoreChildItem -AccountName $dataLakeStorageGen1Name -Path $myrootdir

但这给出了以下内容 错误.如何解决此问题?

But it gives the below mentioned error. how can I fix this issue?

Get-AzureRmDataLakeStoreChildItem:在获取路径/dummy之后的listStatus时出错
操作:LISTSTATUS失败,原因是:错误:令牌长度为6.令牌出了点问题..
2次尝试后引发的最后一次遇到的异常. [使用URI'http://localhost:50342/oauth2/token?resource = https%3A%2F%2Fdatalake检索资源'https://datalake.azure.net'的托管服务访问令牌时出错. azure.net& api-version = 2018-02-01'. 请检查此托管服务是否已配置为在此地址发射令牌,并且关联的托管服务标识是否具有适当的角色分配,然后尝试重新登录.令牌长度为6.令牌存在问题.]
[ServerRequestId:]
在第1行:char:1
+ Get-AzureRmDataLakeStoreChildItem -AccountName"testdatalakegohar" -P ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          :CloseError:(:) [Get-AzDataLakeStoreChildItem],AdlsException
+ FullyQualifiedErrorId:Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreChildItem

Get-AzureRmDataLakeStoreChildItem : Error getting listStatus for path /dummy after
Operation: LISTSTATUS failed with   Error: Token Length is 6. Something is wrong with the token..
Last encountered exception thrown after 2 tries. [There was an error retrieving the managed service access token for resource 'https://datalake.azure.net' using the URI 'http://localhost:50342/oauth2/token?resource=https%3A%2F%2Fdatalake.azure.net&api-version=2018-02-01'.  Please check that this managed service is configured to emit tokens at this address and that the associated managed service identity has the appropriate role assignment and try logging in again.,Token Length is 6. Something is wrong with the token.]
[ServerRequestId:]
At line:1 char:1
+ Get-AzureRmDataLakeStoreChildItem -AccountName "testdatalakegohar" -P ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : CloseError: (:) [Get-AzDataLakeStoreChildItem], AdlsException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreChildItem

推荐答案

哈哈,

您遇到令牌问题:

Please check that this managed service is configured to emit tokens at this address and that the associated managed service identity has the appropriate role assignment and try logging in again.,Token Length is 6. Something is wrong with the token.]

在这种情况下,您需要首先通过传递Connect-AzureRmAccount cmdlet来向Azure进行身份验证,然后运行所需的cmdlet:

In this scenario, you need to authenticate with Azure first by passing the Connect-AzureRmAccount cmdlet first and then run your desired cmdlet: Get-AzureRmDataLakeStoreChildItem
-AccountName


dataLakeStorageGen1Name -Path
dataLakeStorageGen1Name -Path


myrootdir
myrootdir

登录使用Azure PowerShell 或者,如果您想使用REST API,则还有另一种身份验证方法: 使用REST API使用Azure Data Lake Storage Gen1进行最终用户身份验证

Or, if you are wanting to use the REST API, there is another authentication method: End-user authentication with Azure Data Lake Storage Gen1 using REST API

您是否可以运行此cmdlet来确保正确设置了帐户:

Can you run this cmdlet to ensure the account is set up correctly:

Test-AzureRmDataLakeStoreAccount-名称

Test-AzureRmDataLakeStoreAccount -Name


这篇关于通过Powershell访问Azure Datalake存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆