You must delete all Resource Access Management (RAM) resources before you close an Alibaba Cloud account. If any RAM resources remain, the account closure fails.
Verified accounts
If your Alibaba Cloud account has passed identity verification, use the RAM console or RAM APIs to delete the following resources in order:
Delete all virtual MFA devices.
When you delete a RAM user, the virtual MFA device bound to the user is automatically deleted. However, orphaned virtual MFA devices may exist if:
A binding operation failed, which left an unbound virtual MFA device.
You called the CreateVirtualMFADevice operation but did not bind the device to a RAM user.
To delete orphaned devices, call the ListVirtualMFADevices operation to query all virtual MFA devices, and then call the DeleteVirtualMFADevice operation to delete them.
Reset the default logon suffix.
Find your account ID.
Log on to the Alibaba Cloud Management Console. Click your profile picture in the upper-right corner, then click Security Settings. On the Account Center Overview page, note the account ID.
Change the default logon suffix to the account ID.
For more information, see Manage the logon suffixes of RAM users.
Unverified accounts
If your Alibaba Cloud account has not passed identity verification, you cannot access the RAM console. However, other Alibaba Cloud services may have created service-linked roles under your account. Call APIs or use the Alibaba Cloud CLI to delete these roles.
The following example uses Cloud Shell. To open Cloud Shell, log on to the Alibaba Cloud Management Console and click the Cloud Shell icon (
) in the top navigation bar.
Query all RAM roles:
aliyun ram ListRolesIdentify service-linked roles.
Role names that start with
AliyunServiceRoleForare service-linked roles.Delete the roles.
To delete a service-linked role:
Run the following command:
aliyun resourcemanager DeleteServiceLinkedRole --secure --force --RoleName $role_nameReplace
$role_namewith the actual RAM role name.Verify the deletion:
aliyun resourcemanager GetServiceLinkedRoleDeletionStatus --DeletionTaskId $task_idReplace
$task_idwith theDeletionTaskIdreturned in the previous step. IfStatusisSUCCEEDED, the role is deleted.
To delete a standard RAM role, run the following command:
aliyun ram DeleteRole --secure --force --RoleName $role_name --CascadingDelete trueReplace
$role_namewith the actual RAM role name. The--CascadingDelete trueflag automatically detaches all policies before deleting the role.
Verify that all roles are deleted:
aliyun ram ListRolesIf no roles are returned, you can proceed to close your Alibaba Cloud account.