Skip to content

Claude Code Access Request via Cloud Subscription

Configure Claude Code to run through your AWS (Amazon Bedrock) or Azure (Microsoft Foundry) subscription with the required credentials and environment variables.

Table of Contents

Purpose

Provide a streamlined setup guide for enabling Claude Code on AWS or Azure cloud subscriptions.

Audience

Developers with access to a cloud subscription for development purposes.

Prerequisites

  • Cloud Subscription with one of the following:
    • AWS: Bedrock access enabled
    • Azure: Microsoft Foundry access enabled
  • CLI Tools: AWS CLI or Azure CLI (depending on your cloud provider)

Installing Claude Code

Basic Installation

  1. Follow the official installation guide: https://code.claude.com/docs/en/setup
  2. For Windows users: Install Claude Code via WSL (recommended)

Windows-Specific Configuration

Option 1: WSL (Recommended)

  • Install and run Claude Code through WSL

Option 2: Native Windows

  • Configure Git Bash path:
    powershell
    $env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"

Enterprise Proxy Configuration (ZScaler)

If your organization uses ZScaler or another SSL inspection proxy:

  1. Configure .claude.json (in your home directory):

    • Add NODE_EXTRA_CA_CERTS pointing to your ZScaler certificate path
  2. Set environment variable:

    bash
    export NODE_EXTRA_CA_CERTS="/path/to/zscaler-cert.pem"

    Alternative (less secure):

    bash
    export NODE_TLS_REJECT_UNAUTHORIZED=0

Cloud Provider Configuration

AWS (Amazon Bedrock)

5.1.1 Setup Steps

5.1.1.1 Submit Bedrock Use Case (First-Time Only)
  • Open the Amazon Bedrock console
  • Navigate to Chat/Text playground
  • Select an Anthropic model
  • Complete the use case form
5.1.1.2 Configure AWS Credentials

Use any of the AWS SDK authentication methods:

  • aws configure for access keys
  • Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
  • SSO with AWS_PROFILE
  • Console credentials via aws login
  • Bedrock API keys: AWS_BEARER_TOKEN_BEDROCK
5.1.1.3 Enable Bedrock in Claude Code

Required environment variables:

bash
# Enable Bedrock integration
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=eu-central-1  # Required (not read from .aws config)

Optional: Override region for small/fast model:

bash
export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION=eu-central-1

Note: /login and /logout commands are disabled when using Bedrock.

5.1.1.4 Set Model IDs (Optional)

Choose between model IDs or inference profile ARNs:

Using model IDs:

bash
export ANTHROPIC_MODEL='global.anthropic.claude-sonnet-4-5-20250929-v1:0'
export ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-haiku-4-5-20251001-v1:0'

Using inference profile ARNs:

bash
export ANTHROPIC_MODEL='arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/your-model-id'
5.1.1.5 Configure Token Limits

Recommended for Bedrock:

bash
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096
export MAX_THINKING_TOKENS=1024

5.1.2 IAM Permissions

Ensure your IAM role/user has the following permissions:

  • bedrock:InvokeModel
  • bedrock:InvokeModelWithResponseStream
  • bedrock:ListInferenceProfiles
  • Marketplace subscription actions (if applicable)

5.1.3 Troubleshooting

  • Region issues: Confirm model availability in your chosen region or switch AWS_REGION
  • Authentication errors: Verify AWS credentials are properly configured
  • An example scripts added to the ~/.profile in WSL (set for eu-central-1):
    export CLAUDE_CODE_USE_BEDROCK="1"
    export AWS_REGION="eu-central-1"
    export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION="eu-central-1"
    export ANTHROPIC_MODEL="eu.anthropic.claude-sonnet-4-5-20250929-v1:0"
    export AWS_DEFAULT_REGION="eu-central-1"
    export BEDROCK_REGION="eu-central-1"
    export NODE_EXTRA_CA_CERTS="/mnt/c/zscaler.crt"
    export CLAUDE_CODE_MAX_OUTPUT_TOKENS="4096"
    export MAX_THINKING_TOKENS="1024"

Azure (Microsoft Foundry)

5.2.1 Setup Steps

5.2.1.1 Provision Microsoft Foundry Resource
  • Create a Foundry resource in the Azure portal
  • Deploy the following Claude models:
    • Claude Opus
    • Claude Sonnet
    • Claude Haiku
5.2.1.2 Configure Azure Credentials

Choose one authentication method:

Option A: API Key

bash
export ANTHROPIC_FOUNDRY_API_KEY='your-api-key'

Option B: Azure SDK Default Credential Chain

  • Use az login for interactive authentication
  • Relies on Azure SDK default credential resolution

Note: /login and /logout commands are disabled when using Foundry.

5.2.1.3 Enable Foundry and Map Deployments

Required environment variables:

bash
# Enable Microsoft Foundry integration
export CLAUDE_CODE_USE_FOUNDRY=1

# Azure resource name (replace {resource} with your actual resource name)
export ANTHROPIC_FOUNDRY_RESOURCE={resource}

Alternative: Use full base URL:

bash
export ANTHROPIC_FOUNDRY_BASE_URL=https://{resource}.services.ai.azure.com/anthropic

Map model IDs to your deployment names:

bash
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-5'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5'
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-1'

5.2.2 RBAC Permissions

Built-in roles with required permissions:

  • Azure AI User
  • Cognitive Services User

Custom role: For tighter scope, create a custom role with the Microsoft.CognitiveServices/accounts/providers/* data action.

5.2.3 Troubleshooting

  • Authentication errors: Verify Entra ID is configured or set ANTHROPIC_FOUNDRY_API_KEY
  • Deployment issues: Confirm model deployments match your environment variable names

References

Copyright © MSG Systems Romania AI Labs