Gcloud command doesn't allow to switch project

I am trying to use the following command to export sql database on project IDX using the following command:

gcloud sql export sql INSTANCE URI --database=DATABASE --project=PROJECT

But for some reason, gcloud command still use a project id that is unknown to me.

ERROR: (gcloud.sql.export.sql) PERMISSION_DENIED: Cloud SQL Admin API has not been used in project <unknown project id> before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=<unknown project id> then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
- '@type': type.googleapis.com/google.rpc.Help
  links:
  - description: Google developers console API activation
    url: https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=<unknown project id>
- '@type': type.googleapis.com/google.rpc.ErrorInfo
  domain: googleapis.com
  metadata:
    consumer: projects/<unknown project id>
    service: sqladmin.googleapis.com
  reason: SERVICE_DISABLED

Running the same command on my local, I don’t see this problem. Can someone help to explain the issue?

1 Like