Sunday, March 26, 2023

Troubleshooting - Delete Google Workspace account

I recently deleted a Google Workspace account. It's one I've had for 15 years (dating back to the days when this service was called "Google Apps for your Domain")

I finally succeeded in deleting the workspace, although it was anything but smooth sailing. So I'm posting this in case it helps anyone.

First, take a backup

Because it was such an ancient account, obviously I had a lot of data there to retrieve first, which I downloaded using Google Takeout.


First stab at deleting account

I tried clicking the link to delete, as described here:

Which led to...

Problem #1

Was unable to delete account because it said I had projects in GCP.
A link to GCP was provided, which I clicked.

The project list showed a project "alarm-osqu" under my Google Workspace account's Organization. It looked like a Dialog Flow agent.

Another project was shown, not belonging to any Organization. This was the Hotel Reservation agent, that is kind of a template/starter project in Dialog Flow. I guess this one belongs to Google.

I tried to delete project "alarm-osqu". Which led to...

Problem #2

Was told that the agent has liens attached to it. I guess that means some kind of deletion protection.

A link to Dialog Flow was provided, which I clicked.

Problem #3


On arrival at Dialog Flow, I was unable to do much of any kind of management/administration, let alone delete the agent. I was able to edit the content of that agent, i.e. edit/delete Intents and Entities. But I couldn't delete the agent.

Finally I found the answer here:

Solution

I went back to the GCP page and opened the CLI (command line interface).

I ran the following commands:

Set my project as the current project:

arka@cloudshell:~$ gcloud config set project alarm-osqu
arka@cloudshell:~$ gcloud config set project alarm-osqu
Updated property [core/project].


Tried to delete the project, but failed because of I needed to delete the DialogFlow agent, and it's protected by the lien:

arka@cloudshell:~ (alarm-osqu)$ gcloud projects delete alarm-osqu
Your project will be deleted.

Do you want to continue (Y/n)? y

ERROR: (gcloud.projects.delete) FAILED_PRECONDITION: Precondition check failed.
- '@type': type.googleapis.com/google.rpc.PreconditionFailure
violations:
- description: 'A lien to prevent deletion was placed on the project by [You cannot
delete this project because it is linked with a Dialogflow agent. Please follow
the link to Dialogflow and delete the agent: https://console.dialogflow.com/api-client/#/agent/684e3456-0972-46ae-8e97-d5e8e78b9905].
Remove the lien to allow deletion.'
subject: liens/p1095610256492-l8b88642c-f7dd-4442-a9f5-f7db6e05d7d4
type: LIEN
- '@type': type.googleapis.com/google.rpc.Help
links:
- description: Troubleshooting project deletion
url: https://cloud.google.com/resource-manager/docs/troubleshooting-project-deletion
- '@type': type.googleapis.com/google.rpc.ErrorInfo
domain: cloudresourcemanager.googleapis.com
reason: PROJECT_DELETE_LIEN


Listed the lien (for some reason it again told me I can't delete the project, even though I all I asked for was the liens list):

arka@cloudshell:~ (alarm-osqu)$ gcloud alpha resource-manager liens list
NAME: p1095610256492-l8b88642c-f7dd-4442-a9f5-f7db6e05d7d4
ORIGIN: You cannot delete this project because it is linked with a Dialogflow agent. Please follow the link to Dialogflow and delete the agent: https://console.dialogflow.com/api-client/#/agent/684e3456-0972-46ae-8e97-d5e8e78b9905
REASON: Deletion blocked by Dialogflow.
arka@cloudshell:~ (alarm-osqu)$ gcloud alpha resource-manager liens list
NAME: p1095610256492-l8b88642c-f7dd-4442-a9f5-f7db6e05d7d4
ORIGIN: You cannot delete this project because it is linked with a Dialogflow agent. Please follow the link to Dialogflow and delete the agent: https://console.dialogflow.com/api-client/#/agent/684e3456-0972-46ae-8e97-d5e8e78b9905
REASON: Deletion blocked by Dialogflow.


Deleted that cursed lien:

arka@cloudshell:~ (alarm-osqu)$ gcloud alpha resource-manager liens delete p1095610256492-l8b88642c-f7dd-4442-a9f5-f7db6e05d7d4
Deleted [liens/p1095610256492-l8b88642c-f7dd-4442-a9f5-f7db6e05d7d4].
arka@cloudshell:~ (alarm-osqu)$


Confirmed there are no more liens:

arka@cloudshell:~ (alarm-osqu)$ gcloud alpha resource-manager liens list
Listed 0 items.


Finally, delete the project:

arka@cloudshell:~ (alarm-osqu)$ gcloud projects delete alarm-osqu
Your project will be deleted.

Do you want to continue (Y/n)? y

Deleted [https://cloudresourcemanager.googleapis.com/v1/projects/alarm-osqu].

You can undo this operation for a limited period by running the command below.
$ gcloud projects undelete alarm-osqu

See https://cloud.google.com/resource-manager/docs/creating-managing-projects for information on shutting down projects.
arka@cloudshell:~ (alarm-osqu)$


Then I was able to go back to the original instructions to delete the workspace account.

Succeeded. ✅

Links related to this post

No comments:

Post a Comment