from line 1
11# Connect Claude Code to Claude for Government
22
3> Deploy the managed settings that send the Claude Code command-line tool to Claude for Government sign-in, limit what it contacts before a user signs in, and verify the result on macOS, Windows, and Linux.
3> Connect the Claude Code command-line tool to Claude for Government with managed settings on macOS, Windows, and Linux, and confirm a device is set up.
44
55> **Who this is for:** IT administrators who install the Claude Code command-line tool on agency devices and connect it to Claude for Government.
66
77In Claude for Government, Claude Code is in early access. To request access for your agency, contact your Anthropic representative.
88
9A fresh install of Claude Code asks the user to sign in with a claude.ai or Claude Console account. To connect it to Claude for Government instead, each device needs a small managed settings file that sends users to your agency's Claude for Government sign-in. Everything else that governs Claude Code is set on the [Config](https://claude.com/docs/government/config/settings.md) page in this portal and delivered to Claude Code after the user signs in.
9Each device needs managed settings that send users to your agency's Claude for Government sign-in. The organization's Claude Code settings are set on the [Config](https://claude.com/docs/government/config/settings.md) page.
1010
11This page covers the device side: the managed settings, where to put them on each operating system, how a user signs in, and how to confirm a device is set up. Claude Code built into Claude Desktop (the **Code** tab) is configured through Claude Desktop instead, as [Connect Claude Desktop to Claude for Government](https://claude.com/docs/government/deploy-desktop/configure.md) describes.
11> [!NOTE]
12>
13> Claude Code in Claude Desktop's **Code** tab signs in through Claude Desktop and is turned on by the [**Code in Claude Desktop**](https://claude.com/docs/government/config/settings.md#code-in-claude-desktop) switch, not the **Claude Code** switch; see [Connect Claude Desktop to Claude for Government](https://claude.com/docs/government/deploy-desktop/configure.md). The `env` block of these managed settings still applies to Code tab sessions. For the other settings that govern them on a device that also has these managed settings, see [Code in Claude Desktop](https://claude.com/docs/government/security/security-and-data-handling.md#code-in-claude-desktop).
1214
1315## Before you begin
1416
15* **Claude Code is turned on for the organization.** A tenant administrator or organization owner turns on the **Claude Code** switch under [Product availability](https://claude.com/docs/government/config/settings.md#product-availability) on the **Config** page. It is off by default, and while it is off Claude Code exits right after the user signs in.
17* **Claude Code is turned on for the organization.** A tenant administrator or organization owner turns on the **Claude Code** switch under [Product availability](https://claude.com/docs/government/config/settings.md#product-availability) on the **Config** page. It is off by default, and while it is off, Claude Code exits right after the user signs in.
1618* **User accounts exist.** Claude Code signs users in to the same accounts as this portal. Each user needs a [routing rule](https://claude.com/docs/government/tenant-admin/identity-and-access.md) that covers them and a [seat tier](https://claude.com/docs/government/org-admin/seat-tiers.md) with at least one model enabled.
17* **Claude Code is current.** This setup requires Claude Code 2.1.274 or later (`claude --version`).
18* **Claude Desktop is current.** Update Claude Desktop to [the supported version](https://claude.com/docs/government/deploy-desktop/configure.md#before-you-begin) before turning on Claude Code for the terminal.
19* **Devices can reach Claude for Government.** Claude Code must reach the gateway address over HTTPS on port 443, and the user's browser must reach the Claude for Government host, its sign-in service, and your agency's identity provider, the same hosts that [Claude Desktop sign-in](https://claude.com/docs/government/deploy-desktop/configure.md#before-you-begin) needs.
20* **You can place a system-level file or policy.** The settings are enforced only from a system-level location: a file in a system directory, a macOS configuration profile, or a machine-level Windows registry policy. Values for the same keys in a user's own settings cannot override them. Deliver them through your device management system or by hand with administrator rights.
19* **Claude Code is current.** This setup requires Claude Code 2.1.274 or later (`claude --version` in a terminal).
20* **Devices can reach Claude for Government.** Claude Code must reach the gateway address over HTTPS on port 443, and the user's browser must reach the same sign-in hosts that [Claude Desktop needs](https://claude.com/docs/government/deploy-desktop/configure.md#network-access).
21* **You can place a system-level file or policy.** The settings are enforced only from a system file, a macOS configuration profile, or a machine-level Windows policy, and values for the same keys in a user's own settings cannot override them.
2122
2223## The managed settings
2324
24Claude Code reads device-level policy from what it calls managed settings. For Claude for Government they contain two keys that turn on gateway sign-in, an `env` block, and one optional key for devices that also run Claude Desktop.
25For Claude for Government, Claude Code's [managed settings](https://code.claude.com/docs/en/managed-settings) contain these keys, shown as a `managed-settings.json` file:
2526
26| Key | Value | Purpose |
27| - | - | - |
28| `forceLoginMethod` | `"gateway"` | Required. Replaces Claude Code's sign-in choices with a single **Cloud gateway** screen. |
29| `forceLoginGatewayUrl` | The Claude for Government gateway address | Required. The address the **Cloud gateway** screen connects to. |
30| `env` | The eight variables shown below | Required. Keeps Claude Code's telemetry to Anthropic and its pre-sign-in background connections off from the first launch, and sets its request headers, request body fields, and certificate checking as described below. |
31| `parentSettingsBehavior` | `"merge"` | Optional. Where these managed settings govern Code sessions in Claude Desktop, `"merge"` layers Claude Desktop's own restrictions, its sandbox included, under them, as [Interaction with Claude Code's own managed settings](https://claude.com/docs/third-party/claude-desktop/code.md#interaction-with-claude-code%E2%80%99s-own-managed-settings) describes. |
32
33As a `managed-settings.json` file:
34
3527```json theme={null}
3628{
3729 "forceLoginMethod": "gateway",
from line 35
4335 "CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL": "1",
4436 "ANTHROPIC_CUSTOM_HEADERS": "",
4537 "CLAUDE_CODE_EXTRA_BODY": "",
38 "CLAUDE_CODE_EXTRA_METADATA": "",
4639 "NODE_TLS_REJECT_UNAUTHORIZED": "1",
4740 "NODE_EXTRA_CA_CERTS": ""
4841 },
from line 43
5043}
5144```
5245
53For an agency that reaches Claude for Government on a hostname of its own, your Anthropic representative provides the address, which replaces the whole value. Otherwise, replace `<claude-for-government-host>` with the domain name you use to access Claude for Government, the host in your Claude Desktop [`bootstrapUrl`](https://claude.com/docs/government/deploy-desktop/configure#the-managed-setting). The address contains no credentials.
46* **`forceLoginMethod`** (required): replaces Claude Code's sign-in choices with a single **Cloud gateway** screen.
47* **`forceLoginGatewayUrl`** (required): the Claude for Government gateway address that the **Cloud gateway** screen connects to. If your agency reaches Claude for Government on a hostname of its own, ask your Anthropic representative which address to use. Otherwise, replace `<claude-for-government-host>` with the domain name you use to access Claude for Government, the host in your Claude Desktop [`bootstrapUrl`](https://claude.com/docs/government/deploy-desktop/configure#the-managed-setting). The address contains no credentials.
48* **`env`** (required): holds the variables that [Before sign-in](#before-sign-in) describes.
49* **`parentSettingsBehavior`** (devices that also run Claude Desktop): where these managed settings govern Claude Desktop's sessions, `"merge"` layers the policy that Claude Desktop supplies, Code's sandbox included, under them. Without it, Claude Code [can ignore that policy](https://claude.com/docs/third-party/claude-desktop/code.md#interaction-with-claude-code%E2%80%99s-own-managed-settings).
5450
5551### Before sign-in
5652
57Your organization's settings reach Claude Code only after a user has signed in. Until then, the first four variables keep Claude Code's release-notes download, update checks, automatic setup of the official plugin marketplace, and usage telemetry and error reporting to Anthropic off from the first launch. After sign-in the organization's settings keep them off.
53Your organization's settings reach Claude Code only after a user has signed in. `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, `DISABLE_ERROR_REPORTING`, and `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` together keep Claude Code's release-notes download, update checks, automatic setup of the official plugin marketplace, and usage telemetry and error reporting to Anthropic off from the first launch. They stay off after sign-in.
5854
59The last four variables are required as shown. `ANTHROPIC_CUSTOM_HEADERS` and `CLAUDE_CODE_EXTRA_BODY` set to empty strings keep extra request headers and extra request body fields off. `NODE_TLS_REJECT_UNAUTHORIZED` set to `"1"` keeps certificate checking on. `NODE_EXTRA_CA_CERTS` names your agency's certificate authority bundle if your devices need one, and is otherwise left empty.
55Every variable in the sample is required. `ANTHROPIC_CUSTOM_HEADERS`, `CLAUDE_CODE_EXTRA_BODY`, and `CLAUDE_CODE_EXTRA_METADATA` must be empty strings, so a user's or a repository's settings file can't change them. `NODE_TLS_REJECT_UNAUTHORIZED` must be `"1"`, which keeps certificate checking on. `NODE_EXTRA_CA_CERTS` is the path to your agency's certificate authority bundle if your devices need one, as [TLS inspection can require](https://code.claude.com/docs/en/network-config#ca-certificate-store), and is otherwise empty.
6056
61For what each variable controls, see [Environment variables](https://code.claude.com/docs/en/env-vars) in the Claude Code documentation.
57For Claude Code's other environment variables, see [Environment variables](https://code.claude.com/docs/en/env-vars) in the Claude Code documentation.
6258
63### Optional: web proxy settings in the managed settings
59### Web proxy settings
6460
65If your devices use a web proxy that you manage, add `HTTPS_PROXY` and `HTTP_PROXY` (the proxy's address, for example `http://proxy.example.gov:8080`) and `NO_PROXY` (your bypass list, keeping `localhost`, `127.0.0.1`, and `::1`) to the same `env` block, each under both its uppercase and lowercase name. Claude Code then uses that proxy wherever the device connects from, in place of any other proxy setting on the device. If your devices connect directly, leave these variables out rather than setting them to empty strings, because an empty value switches off a proxy a user would otherwise use. On a device that also runs Claude Desktop, Claude Desktop applies the same proxy values to the sessions it runs, as [Interaction with Claude Code managed settings](https://claude.com/docs/third-party/claude-desktop/network-proxy.md#interaction-with-claude-code-managed-settings) describes.
61If your devices use a web proxy that you manage, add `HTTPS_PROXY` and `HTTP_PROXY` (the proxy's address, for example `http://proxy.example.corp:8080`) and `NO_PROXY` (your bypass list, keeping `localhost`, `127.0.0.1`, and `::1`) to the same `env` block, each under both its uppercase and lowercase name. Claude Code then uses that proxy wherever the device connects from, in place of any other proxy setting on the device. Signing in through a proxy whose address starts with `https://` requires Claude Code 2.1.307 or later. If your devices connect directly, leave these variables out rather than setting them to empty strings, because an empty value switches off a proxy a user would otherwise use.
6662
6763## Deploy the settings
6864
69Deliver the settings through your device management system wherever you can, and before users start Claude Code for the first time, so that their first launch lands on the **Cloud gateway** screen. Claude Code reads managed settings when it starts; a user who had it open when the settings arrived quits and starts it again. Use one location per device. If a device receives more than one, Claude Code uses the macOS profile or machine-level Windows policy and ignores the file.
65Deliver the settings through your device management system wherever you can, and before users start Claude Code for the first time, so that their first launch opens the **Cloud gateway** screen. Use one location for each device. Claude Desktop runs Chat, Cowork, and Code through its own Claude Code, which reads these settings, including [proxy values](https://claude.com/docs/third-party/claude-desktop/network-proxy.md#interaction-with-claude-code-managed-settings) and any [`requiredMaximumVersion`](https://claude.com/docs/government/deploy-desktop/configure#claude-code-maximum-version). For how they combine with your organization's settings, see [Code in Claude Desktop](https://claude.com/docs/government/security/security-and-data-handling.md#code-in-claude-desktop).
7066
7167### macOS
7268
73Place the JSON above at `/Library/Application Support/ClaudeCode/managed-settings.json`, or deploy a configuration profile that sets the same top-level keys in the `com.anthropic.claudecode` managed preferences domain, with `env` as a dictionary of strings.
69Place the managed settings file at `/Library/Application Support/ClaudeCode/managed-settings.json`, or deploy a configuration profile that sets the same top-level keys in the `com.anthropic.claudecode` managed preferences domain, with `env` as a dictionary of strings.
7470
7571### Windows
7672
77Place the JSON above at `C:\Program Files\ClaudeCode\managed-settings.json`, or deliver it as machine policy: a string (`REG_SZ`) value named `Settings` under `HKLM\SOFTWARE\Policies\ClaudeCode` whose data is the whole JSON document on one line. As a `.reg` file:
73Place the managed settings file at `C:\Program Files\ClaudeCode\managed-settings.json`, or deliver it as machine policy: a `REG_SZ` value named `Settings` under `HKLM\SOFTWARE\Policies\ClaudeCode` holding the whole JSON document, as in this `.reg` file:
7874
7975```text theme={null}
8076Windows Registry Editor Version 5.00
8177
8278[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\ClaudeCode]
83; substitute your Claude for Government host
84"Settings"="{\"forceLoginMethod\":\"gateway\",\"forceLoginGatewayUrl\":\"https://<claude-for-government-host>/gateway-api\",\"env\":{\"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC\":\"1\",\"DISABLE_TELEMETRY\":\"1\",\"DISABLE_ERROR_REPORTING\":\"1\",\"CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL\":\"1\",\"ANTHROPIC_CUSTOM_HEADERS\":\"\",\"CLAUDE_CODE_EXTRA_BODY\":\"\",\"NODE_TLS_REJECT_UNAUTHORIZED\":\"1\",\"NODE_EXTRA_CA_CERTS\":\"\"},\"parentSettingsBehavior\":\"merge\"}"
79; substitute your gateway address from "The managed settings"
80"Settings"="{\"forceLoginMethod\":\"gateway\",\"forceLoginGatewayUrl\":\"https://<claude-for-government-host>/gateway-api\",\"env\":{\"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC\":\"1\",\"DISABLE_TELEMETRY\":\"1\",\"DISABLE_ERROR_REPORTING\":\"1\",\"CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL\":\"1\",\"ANTHROPIC_CUSTOM_HEADERS\":\"\",\"CLAUDE_CODE_EXTRA_BODY\":\"\",\"CLAUDE_CODE_EXTRA_METADATA\":\"\",\"NODE_TLS_REJECT_UNAUTHORIZED\":\"1\",\"NODE_EXTRA_CA_CERTS\":\"\"},\"parentSettingsBehavior\":\"merge\"}"
8581```
8682
8783A value under `HKEY_CURRENT_USER` does not turn on gateway sign-in.
from line 84
8884
8985### Linux and Windows Subsystem for Linux
9086
91On Linux, place the JSON above at `/etc/claude-code/managed-settings.json` (root required).
87On Linux, place the managed settings file at `/etc/claude-code/managed-settings.json` (root required).
9288
93Claude Code inside Windows Subsystem for Linux (WSL) reads that same path inside each distribution. To manage the setting from Windows instead, add `"wslInheritsWindowsSettings": true` to the machine-level Windows policy or file alongside the keys above; Claude Code inside WSL then reads the Windows settings first and needs no file inside the distribution.
89Claude Code inside Windows Subsystem for Linux (WSL) reads that same path inside each distribution. To manage the settings from Windows instead, add `"wslInheritsWindowsSettings": true` to the machine-level Windows policy or file alongside the other keys. Claude Code inside WSL then reads the Windows settings first and needs no file inside the distribution.
9490
95### A single machine set up by hand
96
97To try the setup before a fleet rollout, create the file at the path for the machine's operating system from an administrator account, then start Claude Code as an ordinary user.
98
9991## Sign in
10092
101With the settings in place, a user's first sign-in on a device goes as follows.
93Before a user's first gateway sign-in, have them remove any earlier claude.ai sign-in with `claude auth logout` in a terminal, or VS Code's **Claude Code: Logout** command. Signing out later also removes the gateway sign-in. VS Code extension users who sign in through the gateway in a terminal need the standalone command-line tool. The copy of Claude Code that the extension runs follows these managed settings and must also meet the [minimum version](#before-you-begin). The version of the copy it bundles is the extension's version number in VS Code's **Extensions** view.
10294
95A user who has used Claude Code on the device before starts the same sign-in with `/login` at the Claude Code prompt. With the settings in place, a first sign-in goes as follows.
96
10397**1. Start Claude Code**
10498
105The user runs `claude` in a terminal. After the first-run theme choice, the **Cloud gateway** screen shows the gateway address, and the user presses **Enter** to connect.
99The user runs `claude` in a terminal. The **Cloud gateway** screen shows the gateway address, and the user presses **Enter** to connect.
106100
107101**2. Confirm the gateway certificate**
108102
109The first time each user connects from a device, Claude Code shows the first 16 characters of the gateway's TLS certificate fingerprint (SHA-256) and asks them to trust it. Publish the expected fingerprint to your users with the rollout (they compare it ignoring colons and letter case), and again when the certificate is renewed, because users are asked again after a renewal. Your Anthropic representative provides it.
103The first time each user connects from a device, Claude Code shows the first 16 characters of the gateway's TLS certificate fingerprint (SHA-256) and asks them to trust it. Publish the expected fingerprint to your users with the rollout (they compare it ignoring colons and letter case), and again when the certificate is renewed. Your Anthropic representative provides it. If your network inspects TLS connections to the gateway, users behind the inspection see the fingerprint of the certificate it presents for the gateway's host. Get that fingerprint from the team that runs the inspection and publish it too. Each time the certificate a device sees changes, its user confirms the new fingerprint and signs in again.
110104
111105**3. Finish sign-in in the browser**
112106
from line 110
116110
117111If the terminal shows **Signed in to Cloud gateway as** followed by the user's email address, the user confirms with **Yes, continue**. The terminal then shows **Connected to Cloud gateway**, and Claude Code downloads the organization's settings and restarts to apply them. If those settings include items Claude Code asks users to approve, such as a [Telemetry endpoint](https://claude.com/docs/government/config/settings.md#telemetry-endpoint), it shows a **Managed settings require approval** prompt the first time and whenever those settings change; **No** exits Claude Code. Unattended runs such as `claude -p` apply the settings without prompting.
118112
119A sign-in lasts until the organization's [Session idle timeout](https://claude.com/docs/government/config/settings.md#session-idle-timeout) or [Maximum session length](https://claude.com/docs/government/config/settings.md#maximum-session-length) is reached, and at most 30 days. It also ends when the user's account is deactivated, when an administrator signs the user out, or when the user signs in to Claude Code on more devices than Claude for Government allows at once (six), which ends the sign-in closest to expiring (see [Sessions](https://claude.com/docs/government/account/sessions.md#how-long-sessions-last)). Claude Code then asks the user to sign in again, which they do with `/login`.
113A sign-in lasts until the organization's [Session idle timeout](https://claude.com/docs/government/config/settings.md#session-idle-timeout) or [Maximum session length](https://claude.com/docs/government/config/settings.md#maximum-session-length) is reached, and at most 30 days. It also ends when the user's account is deactivated or an administrator signs the user out. A new Claude Code sign-in by the same user while six are active ends the one closest to expiring (see [Sessions](https://claude.com/docs/government/account/sessions.md#how-long-sessions-last)). Claude Code then asks the user to sign in again, which they do with `/login` at the Claude Code prompt.
120114
121115## Confirm it worked
122116
123Run through these checks on one configured device before the wider rollout.
117Before the wider rollout, place the managed settings on one device, at the [location for the operating system](#deploy-the-settings), from an administrator account, then run these checks as an ordinary user.
124118
125119**1. Check the sign-in screen**
126120
127Start `claude` as a user who has not signed in. The only sign-in option is the **Cloud gateway** screen showing your gateway address. If Claude Code offers claude.ai or Claude Console sign-in instead, the managed settings did not reach it.
121Start `claude` in a terminal as a user who has not signed in, running `/login` at the Claude Code prompt if they have used Claude Code on the device before. The only sign-in option is the **Cloud gateway** screen showing your gateway address.
128122
129**2. Check the background connections are off**
123**2. Check that the env block arrived**
130124
131Before signing in, run `claude doctor`. On the standard installer it reports auto-updates as disabled by `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, which shows the `env` block reached Claude Code. (Homebrew, WinGet, and Linux package installs report updates as managed by the package manager instead.)
125Before signing in, run `claude doctor` in a terminal. On the standard installer or an npm install it reports auto-updates as disabled by `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, which shows the `env` block reached Claude Code. (Homebrew, WinGet, and Linux package installs report updates as managed by the package manager instead.)
132126
133127**3. Check the setting sources**
134128
135After sign-in, run `/status` inside Claude Code. The API provider reads **Cloud gateway** with your gateway address, and **Setting sources** lists **Enterprise managed settings (remote)**.
129After sign-in, run `/status` inside Claude Code. **API provider** reads **Cloud gateway**, **Gateway URL** shows your gateway address, and **Setting sources** lists **Enterprise managed settings (remote)**.
136130
137131**4. Check that organization settings arrived**
138132
139Change one visible Claude Code setting on the [Config](https://claude.com/docs/government/config/settings.md#claude-code) page for a test organization, start a new Claude Code session as a member of it, and confirm the change took effect.
133Change one visible setting under [Claude Code](https://claude.com/docs/government/config/settings.md#claude-code) on the **Config** page for a test organization, start a new Claude Code session as a member of it, and confirm the change took effect.
140134
141135## Troubleshooting
142136
143137| What you see | Likely cause | What to do |
144138| - | - | - |
145| Claude Code offers claude.ai and Claude Console sign-in instead of the **Cloud gateway** screen | The managed settings did not reach Claude Code: wrong path, a Windows value under `HKEY_CURRENT_USER` or with another name, a misspelled key, or Claude Code was already running | Check the location for the operating system above, then quit and restart Claude Code |
146| The **Cloud gateway** screen says to contact your IT administrator | `forceLoginGatewayUrl` is missing or empty | Add the gateway address to the same managed settings and restart Claude Code |
147| Claude Code reports that it could not resolve the gateway host, or another connection error for the address shown | The address in `forceLoginGatewayUrl` is not exactly the gateway address described under [The managed settings](#the-managed-settings), or the device cannot reach it | Correct the address, or restore the device's route to the gateway over HTTPS on port 443, then restart Claude Code |
148| `Unable to connect to Anthropic services` at first start, before any sign-in screen | The sign-in keys did not reach Claude Code from a system-level location, or Claude Code is out of date | Update Claude Code, or check the settings location, then start it again |
149| `claude doctor`, run before sign-in on the standard installer, reports auto-updates as enabled | The `env` block did not reach Claude Code | Compare the deployed settings with the sample above, then restart Claude Code |
150| When it starts or right after sign-in, Claude Code exits with `Cloud gateway <address> refused managed settings for this account (403): Claude Code may not be enabled for your organization` | The **Claude Code** switch is off at a level that applies to the user (tenant, organization, or directory group) | Turn on the **Claude Code** switch under [Product availability](https://claude.com/docs/government/config/settings.md#product-availability) at that level (at the tenant level, **Reset to default** instead lets each organization's own switch decide), then have the user start Claude Code again. [**Compare config across levels**](https://claude.com/docs/government/config/overview.md#comparing-settings-across-levels) on the **Config** page shows which level turns it off for a user |
151| When it starts or right after sign-in, Claude Code exits with `Couldn't load settings from Cloud gateway <address>` | Claude Code could not reach the gateway while loading the organization's settings | Confirm the device reaches the gateway over HTTPS on port 443, then have the user start Claude Code again. If it persists on a connected device, contact your Anthropic representative |
152| In a session that was working, every request fails with a 403 error saying Claude Code is not turned on for the organization | The **Claude Code** switch was turned off while Claude Code was running | Turn the switch back on at the level that turned it off; the next request then succeeds |
153| Before the user has signed in, Claude Code exits with `Administrator policy requires a Cloud gateway sign-in on this machine` | A credential from earlier use is present: `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` in the environment, an `apiKeyHelper` in the user's settings, or a saved Claude Console key | Remove the variable or the `apiKeyHelper` entry, or have the user run `claude auth logout`, then start `claude` and sign in |
154| Claude Code says the gateway's TLS certificate changed and asks the user to run `/login` | The gateway certificate was renewed | Confirm the new fingerprint with your Anthropic representative, send it to users, and have them run `/login` and accept it |
139| Claude Code offers claude.ai and Claude Console sign-in instead of the **Cloud gateway** screen | The managed settings did not reach Claude Code: wrong path, a Windows value under `HKEY_CURRENT_USER` or with another name, a misspelled key, or Claude Code was already running | Check the [location for the operating system](#deploy-the-settings), then exit and restart Claude Code |
140| The **Cloud gateway** screen says `Gateway login is required by your organization's policy` | `forceLoginGatewayUrl` is missing or empty | Add the gateway address to the same managed settings and restart Claude Code |
141| At sign-in, Claude Code shows `Login Error: Hostname/IP does not match certificate's altnames` | The proxy's address starts with `https://` and Claude Code is older than 2.1.307 | Update Claude Code, then have the user sign in again |
142| Sign-in ends with `Could not verify the gateway's TLS certificate` | Claude Code doesn't trust the certificate's issuer, such as your TLS inspection | Add the issuer's root certificate to the device's [certificate store](https://code.claude.com/docs/en/network-config#ca-certificate-store), or to a bundle that [`NODE_EXTRA_CA_CERTS`](#before-sign-in) names in these managed settings, not where the message says, then restart Claude Code |
143| Claude Code reports `Could not resolve gateway host`, or another connection error for the address shown | The address in `forceLoginGatewayUrl` is not the [gateway address](#the-managed-settings), or the device cannot reach it | Correct the address, or restore the device's route to the gateway over HTTPS on port 443, then restart Claude Code |
144| `Unable to connect to Anthropic services` at first start, before any sign-in screen | `forceLoginMethod` and `forceLoginGatewayUrl` did not reach Claude Code from a system-level location | Check the [location for the operating system](#deploy-the-settings), then start Claude Code again |
145| `claude doctor`, run before sign-in on the standard installer or an npm install, reports auto-updates as enabled | The `env` block did not reach Claude Code | Compare the deployed settings with the [sample managed settings](#the-managed-settings), then restart Claude Code |
146| When it starts or right after sign-in, Claude Code exits with `Cloud gateway <address> refused managed settings for this account (403): Claude Code may not be enabled for your organization` | The **Claude Code** switch is off at a level that applies to the user (tenant, organization, or directory group) | Turn on the **Claude Code** switch under [Product availability](https://claude.com/docs/government/config/settings.md#product-availability) at that level (at the tenant level, **Reset to default** instead lets each organization's own switch decide), then have the user start Claude Code again. [**Compare config across levels**](https://claude.com/docs/government/config/overview.md#comparing-settings-across-levels) on the **Config** page shows which level turns it off |
147| When it starts or right after sign-in, Claude Code exits with `Couldn't load settings from Cloud gateway <address>` | Claude Code could not reach the gateway, or could not apply the settings it sent (the rest of the message says which) | If the message says to check the network connection, confirm the device reaches the gateway over HTTPS on port 443, then have the user start Claude Code again. Otherwise, or if it persists, contact your Anthropic representative |
148| In a session that was working, every request fails with a 403 error that says `Claude Code is not turned on for your organization` | The **Claude Code** switch was turned off while Claude Code was running | Turn the switch back on at the level that turned it off; the next request then succeeds |
149| Before the user has signed in, Claude Code exits with `Administrator policy requires a Cloud gateway sign-in on this machine` | A credential from earlier use is present: `ANTHROPIC_API_KEY` or `ANTHROPIC_AUTH_TOKEN` in the environment, an `apiKeyHelper` in the user's settings, or a saved Claude Console key | Remove the variable or the `apiKeyHelper` entry, or have the user run `claude auth logout` in a terminal, then start `claude` and sign in |
150| Claude Code says `TLS certificate changed since you connected` and asks the user to run `/login` | The gateway certificate was renewed, or your TLS inspection presents a different one | Confirm the new fingerprint with your Anthropic representative, or with the team that runs the inspection, send it to users, and have them run `/login` at the Claude Code prompt, accept it, and sign in again |
151| Sign-in ends with `The gateway's TLS certificate changed during sign-in` | Your TLS inspection presented a different certificate later in the same sign-in | Have every inspecting appliance present the same certificate for the gateway's host on every connection, then have the user sign in again |
155152
156153## Things to know
157154
158* Only a gateway sign-in delivers the organization's settings to the Claude Code command-line tool. Once a user is signed in, those settings replace the Claude Code policy in these managed settings, hooks and permission rules included, apart from the two sign-in keys, any `env` variables the organization's settings leave unset, and the [keys Claude Code reads from every admin source](https://code.claude.com/docs/en/managed-settings#keys-read-from-every-admin-source).
159* A claude.ai sign-in left on a device from earlier use is ignored once these settings are in place. A leftover `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `apiKeyHelper`, or saved Claude Console key is not: until the user has signed in through the gateway, Claude Code stops and asks for its removal, as [Troubleshooting](#troubleshooting) describes.
160* A cloud provider selected earlier in a user's environment or Claude Code settings, such as Amazon Bedrock, still applies whenever Claude Code has no gateway sign-in for the user, for example before the first sign-in or after one expires: Claude Code then uses that provider instead of requiring the gateway sign-in. Remove that provider selection from devices you set up for Claude for Government.
161* Where the Claude Code extension for VS Code is used, have users remove an earlier claude.ai sign-in with `claude auth logout` or the extension's **Claude Code: Logout** command before they sign in through the gateway, not after: both commands clear every credential Claude Code has stored, the gateway sign-in included.
162* To take a device out of this setup, have its users sign out with `claude auth logout` before you remove the settings.
163* After sign-in, the organization's settings turn off the Claude Code settings that run a helper command (`apiKeyHelper`, `proxyAuthHelper`, `awsAuthRefresh`, `awsCredentialExport`, `gcpAuthRefresh`, `otelHeadersHelper`), wherever it is set. If your devices reach the network through a proxy that needs a helper command to authenticate, raise this with your Anthropic representative before you deploy.
155* Only a gateway sign-in delivers the organization's settings to the Claude Code command-line tool, which fetches them before each start and hourly while it runs. After a user signs in, the organization's settings replace the Claude Code policy in these managed settings, including hooks and permission rules. From these managed settings, Claude Code still reads the sign-in keys (`forceLoginMethod` and `forceLoginGatewayUrl`), any `env` variables the organization's settings leave unset, and the [keys Claude Code reads from every admin source](https://code.claude.com/docs/en/managed-settings#keys-read-from-every-admin-source).
156* A cloud provider selected earlier in a user's environment or Claude Code settings, such as Amazon Bedrock, still applies whenever Claude Code has no gateway sign-in for the user, for example before the first sign-in or after one expires. Claude Code then uses that provider instead of requiring the gateway sign-in. Remove that provider selection from devices you set up for Claude for Government.
157* After sign-in, the organization's settings turn off these six Claude Code settings wherever they are set: `apiKeyHelper`, `proxyAuthHelper`, `awsAuthRefresh`, `awsCredentialExport`, `gcpAuthRefresh`, and `otelHeadersHelper`. If your proxy needs `proxyAuthHelper`, raise it with your Anthropic representative before you deploy.
158* To take a device out of this setup, have its users sign out with `claude auth logout` in a terminal, then remove the managed settings.
164159* With Claude for Government, the command-line tool has no access to Claude Code features that [require a claude.ai account](https://code.claude.com/docs/en/feature-availability#features-that-require-a-claude-subscription), such as cloud sessions, Remote Control, and cloud scheduled tasks. [Fast mode](https://code.claude.com/docs/en/fast-mode) isn't available either.
165* With these settings Claude Code does not check for or install updates in the background. Distribute new versions through your software deployment tooling, or have users run `claude update` (standard installer) or their package manager.
166* Code sessions inside Claude Desktop sign in through Claude Desktop, not through these settings, but the `env` block applies to them too. For the other settings that govern them on a device that also has these managed settings, see [Code in Claude Desktop](https://claude.com/docs/government/security/security-and-data-handling.md#code-in-claude-desktop).
160* Because these settings turn off background updates, distribute new versions through your software deployment tooling, or have users run `claude update` in a terminal (standard installer) or their package manager.
167161