本人刚接触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未定义的错误,无语。。。。。。。。
我碰到了同样的问题,现在已经找到解决方案了,你只需用先运行 Get-AzurePublishSettingsFile
下载一个配置文件,再运行 Remove-AzureSubscription
把你的订阅删掉,然后运行 Import-AzurePublishSettingsFile
把之前下载的配置文件重新导入就可以了。
这个问题和MSDN上的是重复的。
Hi,
在中国版Azure中我测试出现了和你一样的问题。在同样的操作下国际版是没有问题的,所以我猜测是不是中国版Azure有什么特别的地方,我已经向相关的团队咨询,如果有任何结果,我将更新我的回复。
Best Regards,
Jambor