本人刚接触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未定义的错误,无语。。。。。。。。