Amazon Web Service PowerShell凭据设置错误

Zeq*_*ang 4 powershell amazon-web-services aws-sdk

我试图通过Windows PowerShell在我的本地计算机上设置我的AWS,它给我以下错误消息;

    PS C:\> Set-AWSCredentials -AccessKey {AAAAAAAAAAAAAAA} -SecretKey {AAAAAAAAAAAAA} -Stor
eAs {default}
Set-AWSCredentials : Cannot evaluate parameter 'AccessKey' because its argument is specified as a script block and
there is no input. A script block cannot be evaluated without input.
At line:1 char:31
+ Set-AWSCredentials -AccessKey {AAAAAAAAAAAAAAA} -SecretKey {AAAAAAAAAAAA ...
+                               ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [Set-AWSCredentials], ParameterBindingException
    + FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Amazon.PowerShell.Common.SetCredentialsCmdlet
Run Code Online (Sandbox Code Playgroud)

我的Powershell版本正在关注;

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1
Run Code Online (Sandbox Code Playgroud)

谁知道问题是什么?

谢谢

Mik*_*cio 8

看起来您需要从代码中删除括号,因为某些原因,首先出现在谷歌中的亚马逊文档包含它们但是如果您查看http://docs.aws.amazon.com/powershell/latest/reference /items/Set-AWSCredentials.html和底部附近的示例你会看到函数真正期望它们在字符串中就像任何其他的PowerShell cmdlet一样.

Set-AWSCredentials -AccessKey AAAAAAAAAAAAAAA -SecretKey AAAAAAAAAAAAA -StoreAs default
Run Code Online (Sandbox Code Playgroud)

应该为你做的伎俩(如果有任何空格确保将字符串包装在引号中)