我正在经历http://azure.microsoft.com/en-us/documentation/articles/hdinsight-use-hive/但得到
Start-AzureHDInsightJob : Request failed after (12) attempts over a period of (00:03:10.4800236) with code: Forbidden
Content:<Error xmlns="http://schemas.microsoft.com/windowsazure"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>ForbiddenError</Code><Message>The server failed to authenticate
the request. Verify that the certificate is valid and is associated with this subscription.</Message></Error>
At D:\sandbox\hadoop\hive\ProcessExampleSampleLog.ps1:15 char:12
+ $hiveJob = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $hiveJob ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Start-AzureHDInsightJob], HttpLayerException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.HDInsight.Framework.Core.Library.WebRequest.HttpLayerExce
ption,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.StartAzureHDInsightJobCmdlet
我通过 Get-AzureSubscription -Current
检查了证书,它给了我:
SubscriptionName : Dev
SubscriptionId : <CORRECT SUBSCRIPTION ID>
<SNIP>
IsDefault : False
Certificate : [Subject]
CN=Kevin
[Issuer]
CN=Kevin
[Serial Number]
<REDACTED>
[Not Before]
13/05/2013 14:27:18
[Not After]
19/04/2113 14:27:18
[Thumbprint]
<THUMBPRINT THAT MATCHES IN AZURE PORTAL WITH DEV SUBSCRIPTION>
CurrentStorageAccountName : <DIFFERENT STORAGE NAME TO THE HDINSIGHT ONE>
ActiveDirectoryUserId : <MY EMAIL>
TokenProvider : Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication.AdalTokenProvider
唯一不匹配的是上面的 CurrentStorageAccountName
不是我用于 HDInsight 的,而是在查询中设置的。
在此之前我也成功执行了Add-AzureAccount
。
我们最近更改了订阅的名称(但在我创建 HDInsight 群集及其存储帐户之前),这可能会导致此问题。
我确实通过 Azure 门户删除了我的证书并重新上传。
我现在有点卡住了。
最佳答案
根据这个http://blogs.msdn.com/b/bigdatasupport/archive/2013/11/21/getting-started-with-hdinsight-powershell-tools-and-sdk.aspx我尚未导入 Azure 发布设置文件。
<小时/>通过 Publishsettings 文件获取 Azure 管理证书:
在计划使用 HDInsight SDK(PowerShell 或 .Net SDK)的每个工作站上,可以使用以下步骤获取 Azure 管理证书 -
- 使用您的 Windows Azure 帐户凭据登录 Windows Azure 管理门户。
登录 Azure 完成并打开门户后,运行 Windows Azure PowerShell 命令以获取设置文件 -
获取 AzurePublishSettingsFile
Get-AzurePublishSettingsFile cmdlet 在 [Windows Azure 管理门户] 上打开一个网页,您可以从中下载订阅信息。该信息包含在 .publishsettings 文件中。
通过运行 cmdlet 导入要由 Windows Azure cmdlet 使用的 Azure 设置文件 –
Import-AzurePublishSettingsFile '<Folder>\YourSubscriptionName-DownlodDate-credentials.publishsettings'
在这里,
'<Folder>\YourSubscriptionName-DownlodDate-credentials.publishsettings'
是您在步骤 2 中保存在工作站上的文件。
Import-AzurePublishSettingsFile cmdlet 执行两件事 -
它解析此 AzurePublishSettingsFile XML 文件,读取证书数据并将该证书安装在本地证书存储中(通常是当前用户/个人) - 该证书将“Windows Azure 工具”设置为“颁发给”和“颁发”通过'。
它会在“C:\Users\userName\AppData\Roaming\Windows Azure PowerShell”文件夹下创建一个名为“WindowsAzureProfile.xml”的文件 - 该文件包含订阅名称、订阅 ID 和 Azure 证书指纹等。
现在你知道了。
关于azure - HDInsight 上的 Hive 存在证书问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23361699/