Configure Claude Code

Important

This feature is in Beta. To use it, a workspace admin must turn on Unity Gateway Managed Configuration from the Previews page. See Manage Azure Databricks previews.

Use agent_native_config.claude_code.managed_settings to include Claude Code settings in your workspace's coding agent configuration. The object uses the same JSON structure as Claude Code's managed-settings.json. Choose keys from the Claude Code settings reference, then check which keys Unity Gateway controls.

After ug writes managed-settings.json, Claude Code applies its own settings precedence. Managed settings generally take precedence over user and project settings. Some settings have additional override rules.

Add Claude Code settings

  1. Open the coding agent configuration in your workspace.

  2. Find the CODING_AGENT_CLAUDE_CODE entry in enabled_agents. Add agent_native_config inside that entry's config object. For example, this entry disables extended thinking and denies Claude Code's Read tool access to .env files:

    {
      "agent": "CODING_AGENT_CLAUDE_CODE",
      "config": {
        "models": { "sources": ["system.ai.claude-sonnet-5-5"] },
        "default_models": { "default_model": "system.ai.claude-sonnet-5-5" },
        "agent_native_config": {
          "claude_code": {
            "managed_settings": {
              "alwaysThinkingEnabled": false,
              "permissions": { "deny": ["Read(//**/.env)"] }
            }
          }
        }
      }
    }
    

    The // in Read(//**/.env) uses Claude Code's syntax for an absolute path. See Configure permissions.

    Merge these fields into the existing entry. Keep the model settings, Model Context Protocol (MCP) servers, and any other settings your team needs.

  3. Save the configuration. Run ug configure --global on each managed device to apply the published settings. See Roll out coding agents with mobile device management (MDM).

On Linux, ug writes /etc/claude-code/managed-settings.json. On macOS, it writes /Library/Application Support/ClaudeCode/managed-settings.json. The settings also apply when a developer starts Claude Code directly after their first ug claude launch.

Use the coding agent configuration's models, default_models, http_headers, and mcp_servers fields for gateway models, defaults, headers, and MCP servers. See the configuration schema for field paths.

How Unity Gateway builds managed settings

On macOS and Linux, each ug configure --global run builds managed-settings.json from Unity Gateway defaults, your managed_settings object, enabled gateway features, and the gateway connection, in that order. A later value takes precedence. Keys absent from the following table pass through as given. Run ug configure --global --dry-run to inspect the generated file and see which keys ug skips.

Keys controlled by ug

Each row names one key in agent_native_config.claude_code.managed_settings and how ug handles it in managed-settings.json.

Key What ug does
allowedMcpServers Shared list: If you set an allowlist, ug keeps your entries and adds gateway MCP servers and WebSearch. To block a gateway MCP server, remove it from mcp_servers.
apiKeyHelper Reserved: ug skips your value and sets the helper to ug auth-token for developer sign-in.
availableModels Conditionally reserved: When any models source is configured, ug skips your value. For models.sources or models.model_services, it writes the model list. For models.model_provider_service or models.unity_catalog_location, it leaves this key out of the file.
awsAuthRefresh Reserved: ug skips your value and leaves this key out of the file. Gateway authentication does not use cloud provider credentials.
awsCredentialExport Reserved: ug skips your value and leaves this key out of the file. Gateway authentication does not use cloud provider credentials.
enforceAvailableModels Conditionally reserved: When any models source is configured, ug skips your value. For models.sources or models.model_services, it enforces the model list. For models.model_provider_service or models.unity_catalog_location, it leaves this key out of the file.
env.ANTHROPIC_API_KEY Reserved: ug skips your value and writes a blank value so shell credentials cannot replace gateway sign-in.
env.ANTHROPIC_AUTH_TOKEN Reserved: ug skips your value and writes a blank value so shell credentials cannot replace gateway sign-in.
env.ANTHROPIC_BASE_URL Reserved: ug skips your value and writes the gateway endpoint.
env.ANTHROPIC_CUSTOM_HEADERS Reserved: ug skips your value and writes request headers from http_headers.
env.ANTHROPIC_DEFAULT_FABLE_MODEL Reserved: ug skips your value. It uses default_models.default_fable_model when set, or the newest model of that family from a static models source.
env.ANTHROPIC_DEFAULT_FABLE_MODEL_NAME Reserved: ug skips your value and leaves this key out of the file. The model picker shows the model ID.
env.ANTHROPIC_DEFAULT_HAIKU_MODEL Reserved: ug skips your value. It uses default_models.default_haiku_model when set, or the newest model of that family from a static models source.
env.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME Reserved: ug skips your value and leaves this key out of the file. The model picker shows the model ID.
env.ANTHROPIC_DEFAULT_OPUS_MODEL Reserved: ug skips your value. It uses default_models.default_opus_model when set, or the newest model of that family from a static models source.
env.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME Reserved: ug skips your value and leaves this key out of the file. The model picker shows the model ID.
env.ANTHROPIC_DEFAULT_SONNET_MODEL Reserved: ug skips your value. It uses default_models.default_sonnet_model when set, or the newest model of that family from a static models source.
env.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME Reserved: ug skips your value and leaves this key out of the file. The model picker shows the model ID.
env.ANTHROPIC_MODEL Conditionally reserved: When Smart Routing is enabled, ug skips your value and leaves this key out of the file. ug claude selects the model at launch.
env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS Reserved: ug skips your value and sets the helper lifetime to match the gateway token.
env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS Reserved: ug skips your value and leaves this key out of the file to preserve one-hour prompt caching.
env.CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY Reserved: ug skips your value and leaves this key out of the file. ug claude sets it at launch when enabled.
env.CLAUDE_CODE_ENABLE_TELEMETRY Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing setting.
env.CLAUDE_CODE_ENHANCED_TELEMETRY_BETA Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing setting.
env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing setting.
env.CLAUDE_CODE_PROPAGATE_TRACEPARENT Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing setting.
env.CLAUDE_CODE_USE_BEDROCK Reserved: ug skips your value and writes a blank value to prevent bypassing the gateway.
env.CLAUDE_CODE_USE_GATEWAY Reserved: ug skips your value and routes Claude Code through the gateway.
env.CLAUDE_CODE_USE_VERTEX Reserved: ug skips your value and writes a blank value to prevent bypassing the gateway.
env.ENABLE_PROMPT_CACHING_1H Default: ug sets "1" to enable one-hour prompt caching unless you set another value.
env.ENABLE_TOOL_SEARCH Default: ug sets "true" to load MCP tools on demand unless you set another value.
env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing setting.
env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing setting.
env.OTEL_TRACES_EXPORTER Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing setting.
forceLoginMethod Reserved: ug skips your value and leaves this key out of the file. The gateway handles sign-in.
gcpAuthRefresh Reserved: ug skips your value and leaves this key out of the file. Gateway authentication does not use cloud provider credentials.
managedMcpServers Reserved: ug skips your value and writes servers from the top-level mcp_servers field.
modelPicker Conditionally reserved: When any models source is configured, ug skips your value. For models.sources or models.model_services, it writes the model picker. For models.model_provider_service or models.unity_catalog_location, it leaves this key out of the file.
otelHeadersHelper Conditionally reserved: When tracing is enabled, ug skips your value and writes the gateway tracing headers helper.
permissions.deny Shared list: ug keeps your deny rules and adds WebSearch because the gateway does not support Claude Code's hosted web search.