使用带有凭证存储的vSphere CLI工具

VMware vSphere CLI for vSphere 6.5包含显示虚拟机属性的工具vminfo.pl 。 我可以成功运行它,如下所示:

 vminfo.pl --url <url> --username <username> --password <password> 

我现在想使用凭据存储,而不是在命令行上传递凭证。 我准备像这样:

  credstore_admin.pl add --server <server> \ --username <username> --password <password> 

<server>url引用的主机。 我可以看到在~/.vmware/credstore/vicredentials.xml创build了一个凭证存储~/.vmware/credstore/vicredentials.xml ,而credstore_admin.pl list返回了预期的结果。

但是,如果我现在运行

 vminfo.pl --url <url> --username <username> 

甚至

 vminfo.pl --url <url> --server <server> --username <username> 

该工具仍然要求我input密码。 那么,如何才能达到vminfo.pl从商店获取凭证的情况呢?

UPDATE 本文档build议,如果选项--credstore存在,即使凭证存储驻留在其默认位置~/.vmware/credstore/vicredentials.xml ,也只会将凭证存储作为身份validation选项进行尝试。

但是,以下两个调用尝试仍然失败,只要它们提示我input密码,而不是从凭证存储区自动检索:

 vminfo.pl --url <url> --username <username> \ --credstore ~/.vmware/credstore/vicredentials.xml vminfo.pl --url <url> --server <server> --username <username> \ --credstore ~/.vmware/credstore/vicredentials.xml