使用Azure CLI重新获取预创建但被遗忘的秘密。

huangapple go评论71阅读模式
英文:

Re-obtaining a pre-created, forgotten secret using Azure CLI

问题

我正在获取我的服务主体注册应用程序的ID。

az ad sp list --all --query="[?displayName=='Shazoo'].appId"

然后,我正在获取为其注册的秘密列表。

az ad app credential list --id 2dda03c9-5d9b-4772-a666-c870a8c933c0

然而,只有hint,没有value。我明白这是遵循门户中可用选项的方式,但我希望能够通过控制台某种方式检索它。(毕竟,GUI不允许我将过期时间设置超过2年,但使用CLI,我可以。)

是否有重新获取秘密的方法?或者每次有人忘记时,我都需要添加一个新的秘密?

英文:

I'm obtaining the ID of my registered application for the service principal.

az ad sp list --all --query "[?displayName=='Shazoo'].appId"

Then I'm obtaining the list of secrets registered for it.

az ad app credential list --id 2dda03c9-5d9b-4772-a666-c870a8c933c0

There's no value, however, only hint. I see how it follows what's available in the portal but I was hoping that I'd be able to retrieve it via the console somehow. (After all, the GUI won't let me set the expiration beyond 2 years but using the CLI, I can.)

Is there a way to re-obtain the secret? Or am I going to need to append a new one each time someone forgets what it was?

答案1

得分: 1

秘密值仅在创建时可检索。此后无法获取秘密值。

您唯一的选择是创建一个新的秘密,并将其值保存在一个安全的位置(例如密钥保管库),以便以后检索。

英文:

Secret value is only retrievable at the time of creation. You cannot get the secret value after that.

Only option available for you is to create a new secret and save its value some place safe (Key Vault, for example) so that it can be retrieved later.

huangapple
  • 本文由 发表于 2023年8月5日 13:07:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76840217.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定