# Migrate a cloud identity from impersonation

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> Move a CloudIdentity off the retired spec.impersonation block and onto a CloudAccount, so Ringleader can issue credentials for your cloud again.


Move a CloudIdentity off the retired `spec.impersonation` block and onto a CloudAccount, so Ringleader can issue credentials for your cloud again. Use this when a CloudIdentity still has a `spec.impersonation` block, because Ringleader cannot issue credentials through it.

## Prerequisites

- [Ringleader installed](https://docs-stg.ringleader.dev/install/), with `rl` signed in to the organization that owns the namespace.
- The organization administrator role, to create the CloudAccount. A namespace administrator can then edit the CloudIdentity.
- The two values that Ringleader gives you for onboarding, as [Keyless cloud access](https://docs-stg.ringleader.dev/cloud-accounts/keyless-access/) describes.
- The examples use the CloudAccount `my-gcp-account`, a CloudIdentity named `gcp` and the namespace `dev`. Replace them with yours.

## Find the identities to migrate

A CloudIdentity that needs this guide has a `spec.impersonation` block. Print each CloudIdentity in a namespace and look for the block:

1. Run `rl cloudidentity get <name> -n <namespace> -o yaml`, replacing the name and the namespace.
2. Look for `spec.impersonation` in the output. A CloudIdentity without the block needs nothing from this guide.

## Create the CloudAccount

Set up keyless access in your cloud and create a CloudAccount, with the Onboard guide for your cloud:

1. Follow the guide for your cloud, up to and including its Create the CloudAccount section:

   - [Onboard Google Cloud](https://docs-stg.ringleader.dev/guides/onboard-gcp/)
   - [Onboard Microsoft Azure](https://docs-stg.ringleader.dev/guides/onboard-azure/)
   - [Onboard AWS](https://docs-stg.ringleader.dev/guides/onboard-aws/)

2. Note the CloudAccount's name.

## Replace the block with a CloudAccount reference

Edit the CloudIdentity so that `spec.cloudAccountRef` names the CloudAccount, in place of `spec.impersonation`:

1. In the CloudIdentity's file, delete the `spec.impersonation` block.
2. Add `cloudAccountRef` under `spec`, naming the CloudAccount:

   ```yaml
   spec:
     provider: gcp
     cloudAccountRef: my-gcp-account
   ```

3. Apply the file with `rl apply -f`.

The CloudAccount must belong to the same organization as the CloudIdentity's namespace. Ringleader refuses the apply if it does not.

## Check that Ringleader can sign in

Wait for the CloudIdentity to report that it works, here `gcp` in the namespace `dev`:

```bash
rl cloudidentity wait gcp -n dev --for Ready --timeout 2m
```

The command returns when the CloudIdentity reports `status.valid: true`.

## Troubleshoot

**If the apply is refused,** check that the CloudAccount exists and belongs to the same organization as the CloudIdentity's namespace. An account that belongs to another organization and an account that does not exist give the same message.

**If the wait times out, or a workstation fails to create,** see [Fix a sign-in that your cloud refuses](https://docs-stg.ringleader.dev/cloud-accounts/keyless-access/#fix-a-sign-in-that-your-cloud-refuses).

## Next steps

- [Cloud accounts and reachability](https://docs-stg.ringleader.dev/cloud-accounts/accounts-reachability/) explains what the CloudAccount records and how a workstation reaches it.
- [CloudIdentity](https://docs-stg.ringleader.dev/reference/resources/cloudidentity/) lists the fields of the CloudIdentity you edited.

