# Cloud SQL Auth Proxy: failed to connect — IAM permission, API or IAM DB authentication problem

**Code:** `Auth Proxy` · **Category:** Google Cloud / Firebase · **Seen on:** Google Cloud

The proxy can't create a connection to the instance because of credentials, permissions or configuration.

## Meaning

Give the proxy's identity `roles/cloudsql.client`, enable the Cloud SQL Admin API, use the right instance connection name (`project:region:instance`), check IAM database authentication settings and database user type, and ensure the proxy reaches the instance's IP type (public/private).

## Common causes

- Missing `cloudsql.client` role
- Cloud SQL Admin API disabled
- Wrong instance connection name
- IAM DB auth user not created
- Private IP only but proxy outside the VPC

## Quick fix

1. Grant `roles/cloudsql.client`
2. Enable `sqladmin.googleapis.com`
3. Verify the connection name with `gcloud sql instances describe`

## Detailed fix by platform

### Shell

1. 

```bash
gcloud services enable sqladmin.googleapis.com
./cloud-sql-proxy PROJECT:REGION:INSTANCE --private-ip
```


## How to diagnose

1. **Role** — cloudsql.client?
2. **API** — Enabled?
3. **Connection name** — Correct?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/gcp/cloudsql-proxy-iam-authentication-failed)
