找不到接受参数' System.Management.Automation.PSCredential'的位置参数。

时间:2017-09-12 07:26:24

标签: powershell azure automation

我尝试在azure自动化中运行DSC配置,但它会被暂停,但有以下异常:

  

"由于首选项变量,运行命令已停止   " ErrorActionPreference"或通用参数设置为停止:A   无法找到接受参数的位置参数   ' System.Management.Automation.PSCredential'

我正在运行的代码是:

var test = {number:1,color:'red'};
function Make(data){
    console.log(data)        //returns test
    console.log(test.number) //returns 1
    console.log(data,test.number) //returns test 1
    console.log(data.number) //returns undefined
};
Make("test");

知道如何解决这个异常吗?

1 个答案:

答案 0 :(得分:1)

我认为你可能需要改变:

Login-AzureRmAccount $cred

要:

Login-AzureRmAccount -Credential $cred

似乎必须命名-Credential才能使用。

相关问题