gpt4 book ai didi

azure - 在 Azure Pipeline 中删除 Azure Key Vault secret 失败

转载 作者:行者123 更新时间:2023-12-03 07:06:23 24 4
gpt4 key购买 nike

我正在尝试使用 Azure Pipeline 删除 Azure Key Vault 中的 secret 。 Key Vault 启用了软删除并禁用了清除保护。我想删除该 secret ,然后在以后的任务中清除该 secret 。

我使用以下任务:

- task: AzureCLI@2
displayName: 'Delete <secret> from Azure Key Vault'
inputs:
azureSubscription: <Valid service connection>
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: 'az keyvault secret delete --name "<secret name>" --vault-name "<Key Vault Name>"'
failOnStandardError: true

当我执行此操作时, secret 被删除,但任务失败并显示以下内容:

{
"attributes": {
"created": "2022-03-03T08:16:55+00:00",
"enabled": true,
"expires": null,
"notBefore": null,
"recoveryLevel": "Recoverable+Purgeable",
"updated": "2022-03-03T08:16:55+00:00"
},
"contentType": null,
"deletedDate": "2022-03-03T09:44:49+00:00",
"id": "https://<vault name>.vault.azure.net/secrets/<secret name>/<ID>",
"kid": null,
"managed": null,
"name": "<secret name>",
"recoveryId": "https://<vault name>.vault.azure.net/deletedsecrets/<secret name>",
"scheduledPurgeDate": "2022-06-01T09:44:49+00:00",
"tags": null,
"value": null
}

##[error]WARNING: Warning! If you have soft-delete protection enabled on this key vault, this secret will be moved to the soft deleted state. You will not be able to create a secret with the same name within this key vault until the secret has been purged from the soft-deleted state. Please see the following documentation for additional guidance.https://learn.microsoft.com/azure/key-vault/general/soft-delete-overview

##[error]Script has output to stderr. Failing as failOnStdErr is set to true.

当错误实际上只是一个警告时,为什么脚本会失败?有什么想法可以解决这个问题吗?

最佳答案

它失败了,因为错误已写入 stderr 并且您在任务上启用了 failOnStandardError。您无法更改任务写入警告的方式,但可以将 failOnStandardError 设置为 false。如果命令返回非零退出代码,任务仍然会失败。

关于azure - 在 Azure Pipeline 中删除 Azure Key Vault secret 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71335477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com