我正在尝试使用 API 自动执行 DLP 扫描。唯一阻碍我完成这个项目的是身份验证。尽管我自己的帐户拥有对所有项目的组织所有者访问权限,但在每个项目中创建和使用具有 BigQuery、存储和 DLP 管理员权限的服务帐户似乎是避免权限被拒绝错误的唯一方法。这是 IAM 问题还是 DLP API 的某些要求和令牌的使用?为什么我的令牌不起作用?我们有很多项目,将来可能会有更多项目,并且希望避免必须在每个项目中创建服务帐户的繁琐和乏味的问题,尤其是必须一次又一次地这样做以保持脚本正常工作。自动化应该是更少的工作而不是更多的工作。
我在下面的项目中使用自己的帐户令牌得到的错误是肯定启用了 DLP API。
"error": {
"code": 403,
"message": "Cloud Data Loss Prevention (DLP) API has not been used in project ###### before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/dlp.googleapis.com/overview?project=###### then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url": "https://console.developers.google.com/apis/api/dlp.googleapis.com/overview?project=######"