To enforce password complexity, length, and expiration requirements for
built-in database users, you can configure the database flags that
AlloyDB for PostgreSQL uses for its
[password policy](https://docs.cloud.google.com/alloydb/docs/database-users/manage-password-policy.md.txt). For a
list of all database flags that AlloyDB supports, see
[Supported database flags](https://docs.cloud.google.com/alloydb/docs/reference/database-flags.md.txt).

## `password.enforce_password_does_not_contain_username`

|---|---|
| Type | `Boolean` |
| Default | `OFF` |
| Instance restarts | No |

If `on`, prohibits using a username as part of a password. This password policy
is case sensitive, so if a username is `Alex`, then a password that contains
`alex` is allowed.

## `password.enforce_expiration`

|---|---|
| Type | `Boolean` |
| Default | `OFF` |
| Instance restarts | No |

Manages the lifetime of a password.

## `password.enforce_complexity`

|---|---|
| Type | `Boolean` |
| Default | `OFF` |
| Instance restarts | No |

Enforces the password complexity policy when new passwords must meet the guidelines specified by other password flags.

## `password.expiration_in_days`

|---|---|
| Type | `Integer` |
| Default | `90` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Requires passwords to be changed within the specified number of days.

## `password.min_uppercase_letters`

|---|---|
| Type | `Integer` |
| Default | `0` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the minimum number of uppercase letters for a password.

## `password.max_uppercase_letters`

|---|---|
| Type | `Integer` |
| Default | `10000` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the maximum number of uppercase letters for a password.

## `password.min_lowercase_letters`

|---|---|
| Type | `Integer` |
| Default | `0` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the minimum number of lowercase letters for a password.

## `password.max_lowercase_letters`

|---|---|
| Type | `Integer` |
| Default | `10000` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the maximum number of lowercase letters for a password.

## `password.min_numerical_chars`

|---|---|
| Type | `Integer` |
| Default | `0` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the minimum number of numerical characters for a password.

## `password.max_numerical_chars`

|---|---|
| Type | `Integer` |
| Default | `10000` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the maximum number of numerical characters for a password.

## `password.min_special_chars`

|---|---|
| Type | `Integer` |
| Default | `0` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the minimum number of special characters for a password.

## `password.max_special_chars`

|---|---|
| Type | `Integer` |
| Default | `10000` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the maximum number of special characters for a password.

## `password.min_pass_length`

|---|---|
| Type | `Integer` |
| Default | `0` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Specifies the minimum number of characters allowed in a password.

## `password.max_pass_length`

|---|---|
| Type | `Integer` |
| Default | `10000` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the maximum number of characters allowed in a password.

## `password.notify_expiration_in_days`

|---|---|
| Type | `Integer` |
| Default | `30` |
| Valid values | `0 ... 10000` |
| Instance restarts | No |

Sets the number of days before a password expires when a built-in (`BUILT_IN`)
database user starts receiving expiration notifications. When the user connects
during this notification window, AlloyDB displays
`Caution: Password is set to expire soon. Be sure to update the password before the expiration time.`
in the connection and logs the message to `postgres.log`.