我正在使用 github actions 将 terraform 代码部署到 azure 中。 我做了一个开发环境,部署工作完美。但现在我要转到 prd、新订阅、将写入状态的新存储帐户、新 spn。 spn 对存储帐户和订阅拥有与 dev One 对其订阅相同的权利。我已经在后端 block 中编写了正确的详细信息,引用了新的存储帐户,我创建了新的 github 操作 secret ,引用了新的 spn,并且我在我的 yml 工作流程文件中使用了这些 secret 。 但我仍然收到此错误:
Error: Failed to get existing workspaces: Error retrieving keys for Storage Account "xxx": storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthorizationFailed" Message="The client 'xxx' with object id 'xxx' does not have authorization to perform action 'Microsoft.Storage/storageAccounts/listKeys/action' over scope '/subscriptions/xxx/resourceGroups/rg-terraform-state-weu/providers/Microsoft.Storage/storageAccounts/xxxx ' or the scope is invalid. If access was recently granted, please refresh your credentials."
我觉得很奇怪,他们所说的“客户端”或“对象 ID”不是我在 key 中输入的应用程序 ID。难道不应该是这样吗?或者还有什么可能是错误的?
最佳答案
这里没什么可说的。
我之前遇到过一些问题,主要是因为将 secret 放在错误的位置或错误命名 secret 的一个小错误。你有ie吗?存储库/组织 secret 中包含该应用程序 ID?
关于azure - github操作不使用azure中的正确spn来执行terraform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76603739/