# Use DBaaS Management Portal

## Login Management Portal

URL: TODO

### Impersonate

1. Get the tenant ID

   Tenant ID can be retrieved either from customer report ticket or lookup in the central database `select id, name, email from central.tenants;`

   The tenant ID will also be shown in the shoot cluster label: `kubectl --kubeconfig /path/to/garden-kubeconfig get shoot -n prod --show-labels`

2. Get the bearer token from web browser console

3. Impersonate customer

   ```sh
   curl -X POST "https://us-west-2.nightly.shared.aws.tidbcloud.com/api/v1/admin/tenant/${id}/impersonation" --header "authorization: Bearer ${token}"
   ```

   The bearer token can be copied from the dbaas console.

   After impersonation, you will be treated as a member of the target tenant. **DO NOT** do any write actions such as create/delete clusters in the console.

4. Un-Impersonate customer

   After you finished the troubleshooting, you must un-impersonate the customer manually. (TODO: add last accessed expire time)

   ```sh
   curl -X Delete "https://us-west-2.nightly.shared.aws.tidbcloud.com/api/v1/admin/tenant/${id}/impersonation" --header "authorization: Bearer ${token}"
   ```
