如何恢复 GCP 项目服务帐号
How to recover GCP project service account
我无意中删除了我的 GCP 项目的服务帐户,而不是 Google 日历 API 和 Dialogflow 服务帐户的服务帐户。
我现在在尝试通过内联代码编辑器将我的 dialogflow 代理部署到 Cloud Functions 时遇到问题。
当我检查日志时,我收到此消息:
2020-07-30 15:48:40.350 WAT
Dialogflow API
CreateCloudFunction
us-central1
bashorun.emma@gmail.com
userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist.
Please recreate this account (for example by disabling and enabling the Cloud Functions API),
or specify a different account.;
com.google.cloud.eventprocessing.manager.api.error.DefaultServiceAccountDoesNotExistException: userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.; Code: FAILED_PRECONDITION com.google.apps.framework.request.StatusException: <eye3 title='FAILED_PRECONDITION'/> generic::FAILED_PRECONDITION: userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist.
Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.; com.google.cloud.eventprocessing.manager.api.error.DefaultServiceAccountDoesNotExistException: userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.; Code: FAILED_PRECONDITION
是否可以取回服务帐户,或者我是否由于其他问题而收到这些错误?
删除服务帐户后,您可以在删除后的 30 天内recover。
为此,您可以 运行 来自云 shell 的以下 command:
gcloud beta iam 服务帐户取消删除 ACCOUNT_ID
可以使用以下过滤器
从stackdriver logging中获取帐户 ID
resource.type="service_account"
resource.labels.email_id="服务帐户名称"
“删除服务帐户”
希望这有助于恢复您的服务帐户。
恢复 App Engine 或任何已删除的服务帐户
您可以取消删除服务帐户。您将需要服务帐户的唯一 ID。如果没有,可以在 Google Cloud Logging 上找到它。
您可以在侧边菜单中找到 Logging
服务:
然后您将需要按日期过滤并键入 service account
以查找服务被删除的确切时间。
那么你可以
选项 1:使用 Google 云命令行
您可以通过在您的计算机上安装命令行来 运行 (https://cloud.google.com/sdk/docs/install)。或者,您可以使用 Google 云平台提供的 Active Shell
在线 运行 它。
您想要运行的命令如下。
gcloud beta iam service-accounts undelete 12345678901234567890
选项 2:使用 Google 云 API
使用 curl
,使用以下命令调用 API。
您需要更改 API_KEY
、PROJECT_ID
和 SERVICE_ACCOUNT_UID
以获得实际值。
curl -X POST \
-H "Authorization: Bearer API_KEY \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://iam.googleapis.com/v1/projects/PROJECT_ID/serviceAccounts/SERVICE_ACCOUNT_UID:undelete"
您可以从 Google 云命令行获取 API_KEY:
gcloud auth application-default print-access-token
同样,您可以在本地计算机上安装 gcloud
,也可以通过 Active Shell
.
在线使用它
我无意中删除了我的 GCP 项目的服务帐户,而不是 Google 日历 API 和 Dialogflow 服务帐户的服务帐户。
我现在在尝试通过内联代码编辑器将我的 dialogflow 代理部署到 Cloud Functions 时遇到问题。 当我检查日志时,我收到此消息:
2020-07-30 15:48:40.350 WAT
Dialogflow API
CreateCloudFunction
us-central1
bashorun.emma@gmail.com
userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist.
Please recreate this account (for example by disabling and enabling the Cloud Functions API),
or specify a different account.;
com.google.cloud.eventprocessing.manager.api.error.DefaultServiceAccountDoesNotExistException: userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.; Code: FAILED_PRECONDITION com.google.apps.framework.request.StatusException: <eye3 title='FAILED_PRECONDITION'/> generic::FAILED_PRECONDITION: userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist.
Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.; com.google.cloud.eventprocessing.manager.api.error.DefaultServiceAccountDoesNotExistException: userFacingMessage:
Default service account 'northern-timer-231210@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.; Code: FAILED_PRECONDITION
是否可以取回服务帐户,或者我是否由于其他问题而收到这些错误?
删除服务帐户后,您可以在删除后的 30 天内recover。
为此,您可以 运行 来自云 shell 的以下 command:
gcloud beta iam 服务帐户取消删除 ACCOUNT_ID
可以使用以下过滤器
从stackdriver logging中获取帐户 IDresource.type="service_account" resource.labels.email_id="服务帐户名称" “删除服务帐户”
希望这有助于恢复您的服务帐户。
恢复 App Engine 或任何已删除的服务帐户
您可以取消删除服务帐户。您将需要服务帐户的唯一 ID。如果没有,可以在 Google Cloud Logging 上找到它。
您可以在侧边菜单中找到 Logging
服务:
然后您将需要按日期过滤并键入 service account
以查找服务被删除的确切时间。
那么你可以
选项 1:使用 Google 云命令行
您可以通过在您的计算机上安装命令行来 运行 (https://cloud.google.com/sdk/docs/install)。或者,您可以使用 Google 云平台提供的 Active Shell
在线 运行 它。
您想要运行的命令如下。
gcloud beta iam service-accounts undelete 12345678901234567890
选项 2:使用 Google 云 API
使用 curl
,使用以下命令调用 API。
您需要更改 API_KEY
、PROJECT_ID
和 SERVICE_ACCOUNT_UID
以获得实际值。
curl -X POST \
-H "Authorization: Bearer API_KEY \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://iam.googleapis.com/v1/projects/PROJECT_ID/serviceAccounts/SERVICE_ACCOUNT_UID:undelete"
您可以从 Google 云命令行获取 API_KEY:
gcloud auth application-default print-access-token
同样,您可以在本地计算机上安装 gcloud
,也可以通过 Active Shell
.