Files
coder/docs/reference/cli/server/create-admin-user.md
T
Nick Vigilante 302edffd87 feat: add JSON output to coder server create-admin-user (#30138)
`coder server create-admin-user` is mostly used in automation but only
printed text.

It now accepts `-o text|json`.
JSON contains the created user's ID, username, email, roles, and
organization memberships.

**Behavior change:** Additive.
The default text output is unchanged and still goes to stderr.
JSON goes to stdout so it can be piped.
The password is never included in any format.

<details>
<summary>Decisions</summary>

- The command talks to the database directly, so the JSON uses a small
local response type instead of a codersdk type.
- JSON goes to stdout while text stays on stderr, matching how other
commands emit machine-readable output.

</details>

Closes [CLI-17](https://linear.app/codercom/issue/CLI-17)

_This PR was generated by Coder Agents on behalf of @nickvigilante._
2026-09-30 12:36:05 -04:00

91 lines
2.7 KiB
Markdown
Generated

---
# Code generated by make gen. DO NOT EDIT.
title: "`coder server create-admin-user`"
description: "Create a new admin user with the given username, email and password and adds it to every organization."
---
<!-- DO NOT EDIT | GENERATED CONTENT -->
Create a new admin user with the given username, email and password and adds it to every organization.
## Usage
```console
coder server create-admin-user [flags]
```
## Options
### --postgres-url
| | |
|-------------|---------------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_PG_CONNECTION_URL</code> |
URL of a PostgreSQL database. If empty, the built-in PostgreSQL deployment will be used (Coder must not be already running in this case).
### --postgres-connection-auth
| | |
|-------------|----------------------------------------|
| Type | <code>password\|awsiamrds</code> |
| Environment | <code>$CODER_PG_CONNECTION_AUTH</code> |
| Default | <code>password</code> |
Type of auth to use when connecting to postgres.
### --ssh-keygen-algorithm
| | |
|-------------|------------------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_SSH_KEYGEN_ALGORITHM</code> |
| Default | <code>ed25519</code> |
The algorithm to use for generating ssh keys. Accepted values are "ed25519", "ecdsa", or "rsa4096".
### --username
| | |
|-------------|------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_USERNAME</code> |
The username of the new user. If not specified, you will be prompted via stdin.
### --email
| | |
|-------------|---------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_EMAIL</code> |
The email of the new user. If not specified, you will be prompted via stdin.
### --password
| | |
|-------------|------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_PASSWORD</code> |
The password of the new user. If not specified, you will be prompted via stdin.
### -o, --output
| | |
|---------|-------------------------|
| Type | <code>text\|json</code> |
| Default | <code>text</code> |
Output format.
### --raw-url
| | |
|------|-------------------|
| Type | <code>bool</code> |
Output the raw connection URL instead of a psql command.