无上阿萌 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条)

报告相同问题?

悬赏问题

  • ¥15 vue3加ant-design-vue无法渲染出页面
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序