• 訊息
  • 託管代理
  • 管理
Search...
⌘K
組織
Admin API工作區
驗證
概覽工作負載身分聯合WIF 參考
監控
用量與成本 API速率限制 APIClaude Code 分析 API
資料與合規
資料駐留API 與資料保留
概覽AWS KMSGoogle Cloud KMSAzure Key Vault
合規 API
概覽取得存取權活動動態對話、檔案與專案組織、使用者、角色與群組設計您的整合錯誤常見問題
Log in
Azure Key Vault
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
管理/加密金鑰

為 CMEK 設定 Azure Key Vault

使用 Azure Key Vault 為您的組織提供加密金鑰。
Configure with the /claude-api skill in Claude Code
claude "/claude-api help me configure a customer-managed encryption key with Azure Key Vault"

本指南將逐步說明如何設定 Azure Key Vault 金鑰,作為您 Anthropic 組織的 customer-managed encryption key(客戶管理的加密金鑰,即 CMEK)。

啟用 CMEK 是永久性的。如果您的 Key Vault 金鑰被刪除或停用,Anthropic 將無法復原使用該金鑰加密的資料。開始之前,請先檢閱警告與限制。

先決條件

  • 一個已啟用 RBAC 授權(enableRbacAuthorization: true)且允許公用網路存取的 Azure Key Vault。Anthropic 會透過公用資料平面端點呼叫您的保存庫;不支援私人端點。
  • 保存庫上已啟用清除保護(enablePurgeProtection: true)。若未啟用,已刪除的金鑰可能在虛刪除保留期間內被永久清除,導致您受 CMEK 保護的資料無法復原。清除保護一旦啟用即無法停用。
  • 在保存庫中建立金鑰以及在其上指派 RBAC 角色的權限。
  • 在您的 Entra 租用戶中建立服務主體的權限(Application Administrator、Cloud Application Administrator 或同等的自訂角色)。
  • 您組織的 Anthropic Admin API 金鑰。
  • 已安裝並完成驗證的 az CLI。
  • 已在保存庫上設定診斷設定,將 AuditEvent 記錄類別路由至 Log Analytics、儲存體帳戶或事件中樞。Azure Key Vault 預設不會發出資料平面稽核記錄(例如 KeyWrap、KeyUnwrap 和 KeyGet),因此若未設定,您將無法取得 Anthropic 金鑰操作的稽核軌跡。

Anthropic 應用程式資訊

為了讓 Anthropic 使用您的加密金鑰,您必須設定 Anthropic 多租用戶應用程式 ID 和顯示名稱。這些值如下:

欄位值
多租用戶應用程式用戶端 ID(美國)8635ae1a-3e5d-44e8-a4ed-e0f614466f87
應用程式顯示名稱anthropic-cmek-client-us

僅使用此處公布的用戶端 ID 和顯示名稱。切勿信任透過電子郵件、聊天或任何導入管道提供的識別碼。

加密金鑰設定

  1. 1

    同意 Anthropic 多租用戶應用程式

    此步驟會在您的 Entra 租用戶中為 Anthropic 的 CMEK 用戶端應用程式建立服務主體。該應用程式不會請求任何 Microsoft Graph 權限;它的存在僅作為 Key Vault 資料平面存取的聯合目標。

    az ad sp create --id 8635ae1a-3e5d-44e8-a4ed-e0f614466f87

    從輸出中擷取 id 欄位。這是服務主體在您租用戶中的物件 ID,您在指派 RBAC 角色時會用到它。

    {
      "appId": "8635ae1a-3e5d-44e8-a4ed-e0f614466f87",
      "displayName": "anthropic-cmek-client-us",
      "id": "<sp-object-id>"
    }

    如果服務主體已存在於您的租用戶中(來自先前的嘗試或其他整合),az ad sp create 會以「already exists」錯誤結束。請改為擷取其物件 ID:

    az ad sp show --id 8635ae1a-3e5d-44e8-a4ed-e0f614466f87 --query id -o tsv

    此步驟沒有對應的入口網站操作。如果您本機未安裝 Azure CLI,請從入口網站頂端導覽列開啟 Cloud Shell。命令成功執行後,您可以在 Microsoft Entra ID > Enterprise applications 中清除預設的應用程式類型篩選條件並搜尋 anthropic-cmek-client-us,以找到服務主體的物件 ID。

    anthropic-cmek-client-us 的 Microsoft Entra 企業應用程式概觀,顯示其 Application ID 和 Object ID。
    在服務主體的 Entra 企業應用程式概觀頁面上找到其 Object ID(物件 ID)。
  2. 2

    在您的保存庫中建立 RSA 金鑰

    Azure Key Vault 不支援對稱金鑰包裝,因此金鑰必須是 RSA(3072 位元或更大),且其允許的操作中須包含 wrapKey 和 unwrapKey。

    az keyvault key create \
      --vault-name <your-vault-name> \
      --name <your-key-name> \
      --kty RSA --size 3072 \
      --ops wrapKey unwrapKey

    若要使用 HSM 支援的金鑰,請使用 --kty RSA-HSM(需要 Premium SKU 保存庫)。此整合可接受軟體保護的 RSA 金鑰。

    從入口網站開啟您的 Key Vault,選取 Keys,然後選取 Generate/Import。將金鑰類型設為 RSA,大小設為 3072 或更大。若要將金鑰限制為僅能包裝和解除包裝,請開啟金鑰版本,捲動至 Permitted operations,並取消勾選 Wrap Key 和 Unwrap Key 以外的所有項目。

    Azure Key Vault 建立金鑰頁面,已選取 Generate 選項、RSA 金鑰類型和 3072 RSA 金鑰大小。
    建立大小為 3072 或更大的 RSA 金鑰。
    Azure Key Vault 金鑰版本,其 Permitted operations 限制為 Wrap Key 和 Unwrap Key。
    將 Permitted operations(允許的操作)限制為 Wrap Key 和 Unwrap Key。
  3. 3

    授予 Anthropic 服務主體存取您金鑰的權限

    將 Key Vault Crypto User 角色指派給第一個步驟中的服務主體,範圍限定為個別金鑰而非整個保存庫。

    VAULT_ID=$(az keyvault show --name <your-vault-name> --query id -o tsv)
    
    az role assignment create \
      --role "Key Vault Crypto User" \
      --assignee-object-id <sp-object-id> \
      --assignee-principal-type ServicePrincipal \
      --scope "${VAULT_ID}/keys/<your-key-name>"

    內建的 Key Vault Crypto User 角色會在其指派範圍內授予金鑰密碼編譯操作(加密、解密、包裝、解除包裝、簽署、驗證)以及金鑰讀取權限。您在上一個步驟中對金鑰設定的 --ops wrapKey unwrapKey 限制會進一步縮小可對此金鑰成功執行的操作範圍,因此實際上 Anthropic 只能執行包裝和解除包裝。

    從入口網站開啟該金鑰(而非保存庫),選取其 Access control (IAM) 索引標籤,按一下 Add > Add role assignment,選取 Key Vault Crypto User,並將其指派給 anthropic-cmek-client-us 服務主體。

    專用保存庫替代方案: Microsoft 建議每個應用程式使用專用保存庫,並在保存庫範圍指派角色。如果您佈建的保存庫僅存放此 Anthropic CMEK 金鑰,則可改為在保存庫範圍指派角色,效果相同。當金鑰位於共用保存庫中時,請將範圍限定為個別金鑰。

    Azure Key Vault Access control (IAM) 角色指派,顯示 anthropic-cmek-client-us 服務主體已被指派 Key Vault Crypto User 角色。
    將 Key Vault Crypto User 指派給 Anthropic 服務主體,範圍限定為該金鑰。
  4. 4

    驗證您的保存庫設定

    az keyvault show --name <your-vault-name> \
      --query "{rbac:properties.enableRbacAuthorization, purge:properties.enablePurgeProtection, pub:properties.publicNetworkAccess, net:properties.networkAcls.defaultAction, ipRules:properties.networkAcls.ipRules, uri:properties.vaultUri, tenantId:properties.tenantId}"

    確認以下項目:

    • rbac 為 true。
    • purge 為 true。如果是 false 或 null,請先在保存庫上啟用清除保護再繼續。若未啟用,虛刪除的金鑰可能在保留期間內被永久清除,導致您受 CMEK 保護的資料無法復原。
    • pub 為 "Enabled"。如果是 "Disabled",Anthropic 將無法透過其公用資料平面端點連線至保存庫,驗證將會失敗。
    • net 為 "Allow";或者,如果是 "Deny",則 ipRules 須包含 Anthropic 的輸出 IP 範圍(請聯絡 Anthropic 以取得目前的清單)。
    • uri 是您在註冊金鑰時使用的保存庫 URI。
    • tenantId 是管理該保存庫的租用戶。註冊金鑰時請使用此值作為 tenant_id,而非您目前作用中訂用帳戶的租用戶(在跨租用戶設定中,兩者可能不同)。
  5. 5

    向 Anthropic 註冊金鑰

    透過 Admin API 建立外部金鑰設定。

    curl -sS https://api.anthropic.com/v1/organizations/external_keys \
      -H "x-api-key: <anthropic-admin-api-key>" \
      -H "anthropic-version: 2023-06-01" \
      -H "content-type: application/json" \
      -d '{
        "display_name": "<friendly-name>",
        "geo": "us",
        "provider_config": {
          "type": "azure",
          "vault_uri": "https://<your-vault-name>.vault.azure.net/",
          "key_name": "<your-key-name>",
          "tenant_id": "<your-tenant-id>"
        }
      }'

    回應中包含外部金鑰 ID:

    {
      "type": "external_key",
      "id": "ekey_<id>",
      "display_name": "<friendly-name>"
    }
  6. 6

    驗證金鑰

    對您的金鑰觸發一次加密和解密的往返測試。這可確認 Anthropic 能夠向您的租用戶進行驗證,並執行包裝和解除包裝操作。

    curl -sS -X POST https://api.anthropic.com/v1/organizations/external_keys/ekey_<id>/validate \
      -H "x-api-key: <anthropic-admin-api-key>" \
      -H "anthropic-version: 2023-06-01" \
      -H "content-type: application/json" -d '{}'

    成功的回應如下所示:

    { "type": "external_key_validation", "status": "success", "error": null }

    如果驗證失敗,error 欄位會描述問題。常見原因包括:

    • RBAC 傳播延遲: 角色指派可能需要幾分鐘才會生效。請稍候再重試。
    • 網路 ACL 封鎖 Anthropic: 請依照驗證步驟中的說明確認公用網路存取和 ipRules。
    • 工作負載身分識別上的條件式存取原則: 如果您的租用戶有針對服務主體的條件式存取原則,請排除 Anthropic 服務主體,或將 Anthropic 的輸出 IP 範圍新增至該原則的具名位置。
  7. 7

    將金鑰附加至工作區

    金鑰驗證完成後,將其附加至工作區,以為該工作區的資料啟用 CMEK。

    curl -sS -X POST https://api.anthropic.com/v1/organizations/workspaces/<workspace-id> \
      -H "x-api-key: <anthropic-admin-api-key>" \
      -H "anthropic-version: 2023-06-01" \
      -H "content-type: application/json" \
      -d '{
        "external_key_id": "ekey_<id>"
      }'

Terraform

對於基礎架構即程式碼(infrastructure-as-code)的部署,相同的步驟可對應至 azurerm 和 azuread 提供者。

Was this page helpful?

  • 先決條件
  • Anthropic 應用程式資訊
  • 加密金鑰設定
  • Terraform