无上阿萌 2016-02-02 09:52 采纳率: 100%
浏览 2694
已采纳

powershell管理azure的HDInsight报错

本人刚接触azure和powershell,尝试用powershell管理HDInsight,但是最简单的指令都没走通,我的azure powershell的版本为1.0.3,用下载器装的没改过任何配置,连的是中国版的azure

开始时用get-azureHdinsightCluster,但是会报身份验证失败什么的,但是我已经通过身份验证并且选择了subscription
图片说明

警告: The Azure Service Management (ASM) cmdlets for HDInsight are deprecated and will be removed in a future release.
Please use the ARM version of this cmdlet: Get-AzureRmHDInsightCluster
Get-AzureHDInsightCluster : Request failed with code:Forbidden
Content:<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><C
ode>ForbiddenError</Code><Message>The server failed to authenticate the request. Verify that the certificate is valid a
nd is associated with this subscription.</Message></Error>
所在位置 行:1 字符: 1
+ Get-AzureHDInsightCluster
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AzureHDInsightCluster], HttpLayerException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.HDInsight.Framework.Core.Library.WebRequest.HttpLayerE
   xception,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.GetAzureHDInsightClusterCmdlet

另外还有个警告说不要用ASM要用ARM,于是重新用ARM登录然后执行get-azureRmHdinsightCluster,报错如下namespace未定义什么的。。(其他rm指令也报类似的错都是namespace错)
图片说明

 Get-AzureRmHDInsightCluster : InvalidResourceNamespace: The resource namespace 'Microsoft.HDInsight' is invalid.
所在位置 行:1 字符: 1
+ Get-AzureRmHDInsightCluster
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureRmHDInsightCluster],CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.HDInsight.GetAzureHDInsightCommand

按道理说两种方式应该都能获取到集群信息的,只是第一种不建议用,结果两种都报错,实在搞不懂了特来求助,希望两个方式都能弄清楚原因,先谢过!


注:以上都是按照官方文档操作的,get-azureSubscription能正常看到订阅号,也用select-azureSubscription选择了一个订阅号,所以身份验证登录应该都没有问题。
还有就是我在ASM模式操作azure其他的资源都不报错没问题,一操作HDInsight就报“请求失败身份验证出错“;
如果用ARM模式操作任何azure资源都会报namespace未定义的错误,无语。。。。。。。。

  • 写回答

3条回答

  • bbetstcw 2016-02-03 07:38
    关注

    我碰到了同样的问题,现在已经找到解决方案了,你只需用先运行 Get-AzurePublishSettingsFile 下载一个配置文件,再运行 Remove-AzureSubscription 把你的订阅删掉,然后运行 Import-AzurePublishSettingsFile 把之前下载的配置文件重新导入就可以了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?