AzureException:无法使用匿名凭据访问容器,并且在配置中找不到它们的凭据

AzureException: Unable to access container using anonymous credentials, and no credentials found for them in the configuration

我正在尝试使用 Azure HDInsight 的 Hadoop。我正在通过 ssh 和 运行 以下

登录集群
hadoop jar jar_name class_name wasb://container@storagename.core.windows.net/inputdir wasb://container@storagename.core.windows.net/outputdir 

但我得到以下异常:

Exception in thread "main" org.apache.hadoop.fs.azure.AzureException: org.apache.hadoop.fs.azure.AzureException: Unable to access container xxx in account yyy.core.windows.net using anonymous credentials, and no credentials found for them in the configuration.

我正在使用 azure cli,并且在 运行 上述 hadoop 作业之前 运行 "azure login"。

请告诉我如何修复此错误。

Ubuntu 12.04 在这些机器上运行。

PS:也在 Azure 论坛上发布了此内容,但在此处重新发布以吸引更广泛的受众。

编辑: 你的存储位置应该是wasb://container@storageacctname.blob.core.windows.net/inputdir

听起来您的集群没有附加到该存储帐户。重新创建集群并确保保存 jar 的帐户已附加到集群。否则,将您的 jar 移动到已连接的存储帐户!

这个问题已经解决,我把答案贴在这里,以防有人遇到同样的问题。

我犯了几个愚蠢的错误。

1) 应该是b://@.blob.core.windows.net。我之前错过了 'blob'。 2) 应该有一个尾随的'/'。所以应该是 hdfs dfs -ls wasb://data2@dsparqstorage.core.windows.net/

我遇到了这个错误。

我曾经写过

wasb://directory/

而不是

wasb://container@storageaccount.blob.core.windows.net/directory/

使用 Azure Blob 存储的正确格式是

wasbs://<container>@<storage-account-name>.blob.core.windows.net/<directory>/

始终确保以 /

结束您的 wasb