共用方式為


configure 命令

在現有的 Data API 產生器組態檔中設定非實體執行階段和資料來源屬性。 未指定的選項會讓現有值保持不變。 如果提供的任何選項無效,則整個更新都會失敗 (全有或全無)。

語法

dab configure [options]

備註

此指令不會變更區 entities 段。 用於 dab update 實體變更。

快速瀏覽

Option 總結
-c, --config 設定檔的路徑(預設 dab-config.json值)。
--data-source.database-type 設定資料庫類型。
--data-source.connection-string 設定資料庫連接字串。
--data-source.options.database 適用於 NoSql 的 Cosmos DB 資料庫名稱。
--data-source.options.container 適用於 NoSql 的 Cosmos DB 容器名稱。
--data-source.options.schema Cosmos DB for NoSQL 的架構路徑。
--data-source.options.set-session-context 啟用會話上下文。
--runtime.graphql.depth-limit 限制查詢深度上限。
--runtime.graphql.enabled 啟用或停用 GraphQL 端點。
--runtime.graphql.path 自訂 GraphQL 端點路徑。
--runtime.graphql.allow-introspection 允許或拒絕 GraphQL 的內省功能。
--runtime.graphql.multiple-mutations.create.enabled 啟用多重創造突變。
--runtime.rest.enabled 啟用或停用 REST 端點。
--runtime.rest.path 自訂 REST 端點路徑。
--runtime.rest.request-body-strict 嚴格執行 REST 請求的實體驗證。
--runtime.mcp.enabled 啟用或停用 MCP 端點。
--runtime.mcp.path 自訂 MCP 端點路徑。
--runtime.mcp.dml-tools.enabled 啟用或停用所有 MCP DML 工具。
--runtime.mcp.dml-tools.describe-entities.enabled 啟用或停用描述實體工具。
--runtime.mcp.dml-tools.create-record.enabled 啟用或停用建立記錄工具。
--runtime.mcp.dml-tools.read-records.enabled 啟用或停用讀取記錄工具。
--runtime.mcp.dml-tools.update-record.enabled 啟用或停用更新記錄工具。
--runtime.mcp.dml-tools.delete-record.enabled 啟用或停用刪除記錄工具。
--runtime.mcp.dml-tools.execute-entity.enabled 啟用或停用執行實體工具。
--runtime.cache.enabled 啟用或停用全域快取。
--runtime.cache.ttl-seconds 全域快取 TTL(以秒為單位)。
--runtime.host.mode 設定主機模式:開發或生產。
--runtime.host.cors.origins 允許的 CORS 來源。
--runtime.host.cors.allow-credentials 設定 CORS 允許憑證。
--runtime.host.authentication.provider 驗證提供者。
--runtime.host.authentication.jwt.audience JWT 觀眾聲明。
--runtime.host.authentication.jwt.issuer JWT 發行者索賠。
--azure-key-vault.endpoint Azure 金鑰保存庫基底端點。
--azure-key-vault.retry-policy.mode 重試政策模式。
--azure-key-vault.retry-policy.max-count 重試嘗試次數上限。
--azure-key-vault.retry-policy.delay-seconds 重試之間的延遲。
--azure-key-vault.retry-policy.max-delay-seconds 指數重試的最大延遲。
--azure-key-vault.retry-policy.network-timeout-seconds 網路呼叫逾時。
--runtime.telemetry.azure-log-analytics.enabled 啟用 Azure Log Analytics 遙測。
--runtime.telemetry.azure-log-analytics.dab-identifier 區分對數起源。
--runtime.telemetry.azure-log-analytics.flush-interval-seconds 在幾秒鐘內沖洗節奏。
--runtime.telemetry.azure-log-analytics.auth.custom-table-name 自訂資料表名稱。
--runtime.telemetry.azure-log-analytics.auth.dcr-immutable-id 資料收集規則 ID。
--runtime.telemetry.azure-log-analytics.auth.dce-endpoint 資料收集端點。
--runtime.telemetry.file.enabled 啟用檔案接收遙測。
--runtime.telemetry.file.path 記錄檔的路徑。
--runtime.telemetry.file.rolling-interval 滾動中斷。
--runtime.telemetry.file.retained-file-count-limit 保留的檔案數目上限。
--runtime.telemetry.file.file-size-limit-bytes 滾動前每個文件的最大大小。
--help 顯示此說明畫面。
--version 顯示版本資訊。

-c, --config

設定檔的路徑。 預設為 dab-config.json 除非 dab-config.<DAB_ENVIRONMENT>.json 存在,其中 DAB_ENVIRONMENT 是環境變數。

Example

dab configure \
  --config ./dab-config.json \
  --runtime.rest.enabled true

--data-source.database-type

資料庫類型。

允許的值:

  • MSSQL
  • PostgreSQL
  • CosmosDB_NoSQL
  • MySQL

Example

dab configure \
  --data-source.database-type PostgreSQL

產生的設定

{
  "data-source": {
    "database-type": "postgresql"
  }
}

--data-source.connection-string

資料來源的連接字串。

Example

dab configure \
  --data-source.connection-string "Server=myserver;Database=mydb;User Id=myuser;Password=mypassword;"

--data-source.options.database

適用於 NoSql 的 Cosmos DB 資料庫名稱。

Example

dab configure \
  --data-source.options.database MyCosmosDatabase

--data-source.options.container

適用於 NoSql 的 Cosmos DB 容器名稱。

Example

dab configure \
  --data-source.options.container MyCosmosContainer

--data-source.options.schema

Cosmos DB for NoSQL 的架構路徑。

Example

dab configure \
  --data-source.options.schema ./schema.gql

--data-source.options.set-session-context

啟用會話上下文。

允許的值:

  • true (預設值)
  • false

Example

dab configure \
  --data-source.options.set-session-context false

產生的設定

{
  "data-source": {
    "options": {
      "set-session-context": false
    }
  }
}

--runtime.graphql.depth-limit

Max 允許巢狀查詢的深度。

允許的值:

  • $(0,2147483647]$(含)
  • -1 以移除限制

Example

dab configure \
  --runtime.graphql.depth-limit 3

產生的設定

{
  "runtime": {
    "graphql": {
      "depth-limit": 3
    }
  }
}

--runtime.graphql.enabled

啟用 DAB 的 GraphQL 端點。

Example

dab configure \
  --runtime.graphql.enabled false

--runtime.graphql.path

自訂 DAB 的 GraphQL 端點路徑。 路徑前綴為 /

Example

dab configure \
  --runtime.graphql.path /graphql

--runtime.graphql.allow-introspection

允許或拒絕 GraphQL 的內省請求。

Example

dab configure \
  --runtime.graphql.allow-introspection false

--runtime.graphql.multiple-mutations.create.enabled

在產生的 GraphQL 架構中啟用或停用多重變異創建操作。

Example

dab configure \
  --runtime.graphql.multiple-mutations.create.enabled true

--runtime.rest.enabled

啟用 DAB 的 REST 端點。

Example

dab configure \
  --runtime.rest.enabled false

--runtime.rest.path

自訂 DAB 的 REST 端點路徑。 路徑前綴為 /

Example

dab configure \
  --runtime.rest.path /myapi

產生的設定

{
  "runtime": {
    "rest": {
      "path": "/myapi"
    }
  }
}

--runtime.rest.request-body-strict

禁止多餘的 REST 請求正體欄位。

Example

dab configure \
  --runtime.rest.request-body-strict true

--runtime.mcp.enabled

啟用 DAB 的 MCP 端點。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.enabled false

產生的設定

{
  "runtime": {
    "mcp": {
      "enabled": false
    }
  }
}

--runtime.mcp.path

自訂 DAB 的 MCP 端點路徑。 路徑前綴為 /

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.path /mcp2

產生的設定

{
  "runtime": {
    "mcp": {
      "path": "/mcp2"
    }
  }
}

--runtime.mcp.dml-tools.enabled

啟用 DAB 的 MCP DML 工具端點。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.dml-tools.enabled false

--runtime.mcp.dml-tools.describe-entities.enabled

啟用 DAB 的 MCP 描述實體工具。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.dml-tools.describe-entities.enabled false

--runtime.mcp.dml-tools.create-record.enabled

啟用 DAB 的 MCP 建立錄音工具。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.dml-tools.create-record.enabled false

--runtime.mcp.dml-tools.read-records.enabled

啟用 DAB 的 MCP 讀取記錄工具。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.dml-tools.read-records.enabled false

--runtime.mcp.dml-tools.update-record.enabled

啟用 DAB 的 MCP 更新記錄工具。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.dml-tools.update-record.enabled false

--runtime.mcp.dml-tools.delete-record.enabled

啟用 DAB 的 MCP 刪除錄音工具。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.dml-tools.delete-record.enabled false

--runtime.mcp.dml-tools.execute-entity.enabled

啟用 DAB 的 MCP 執行實體工具。

備註

此選項僅在 v1.7 預發布 CLI(目前為 RC)中提供。 安裝時用 dotnet tool install microsoft.dataapibuilder --prerelease.

Example

dab configure \
  --runtime.mcp.dml-tools.execute-entity.enabled false

--runtime.cache.enabled

全域啟用 DAB 快取。 你也必須為每個實體啟用快取功能。

Example

dab configure \
  --runtime.cache.enabled true

產生的設定

{
  "runtime": {
    "cache": {
      "enabled": true
    }
  }
}

--runtime.cache.ttl-seconds

自訂 DAB 快取的全域預設時間,設定為秒數。

Example

dab configure \
  --runtime.cache.ttl-seconds 30

產生的設定

{
  "runtime": {
    "cache": {
      "enabled": false,
      "ttl-seconds": 30
    }
  }
}

--runtime.host.mode

設定主機的 DAB 運行模式。

允許的值:

  • Development
  • Production

Example

dab configure \
  --runtime.host.mode Development

產生的設定

{
  "runtime": {
    "host": {
      "mode": "development"
    }
  }
}

--runtime.host.cors.origins

在 CORS 中允許重寫起源。 以空格分隔的清單形式提供數值。

Example

dab configure \
  --runtime.host.cors.origins \
  https://contoso.com \
  https://fabrikam.com

產生的設定

{
  "runtime": {
    "host": {
      "cors": {
        "origins": [
          "https://contoso.com",
          "https://fabrikam.com"
        ]
      }
    }
  }
}

--runtime.host.cors.allow-credentials

設定標頭的 Access-Control-Allow-Credentials 值。

Example

dab configure \
  --runtime.host.cors.allow-credentials true

--runtime.host.authentication.provider

設定認證提供者名稱。

Example

dab configure \
  --runtime.host.authentication.provider AppService

--runtime.host.authentication.jwt.audience

設定 JWT 代幣的預定接收者。

Example

dab configure \
  --runtime.host.authentication.jwt.audience api://my-app

--runtime.host.authentication.jwt.issuer

設定發行 JWT 令牌的實體。

Example

dab configure \
  --runtime.host.authentication.jwt.issuer https://login.microsoftonline.com/common/v2.0

產生的設定

{
  "runtime": {
    "host": {
      "authentication": {
        "provider": "AppService",
        "jwt": {
          "audience": "api://my-app",
          "issuer": "https://login.microsoftonline.com/common/v2.0"
        }
      }
    }
  }
}

--azure-key-vault.endpoint

設定 Azure Key Vault 端點網址。

Example

dab configure \
  --azure-key-vault.endpoint https://my-vault.vault.azure.net

--azure-key-vault.retry-policy.mode

設定重試政策模式。

允許的值:

  • fixed
  • exponential

Example

dab configure \
  --azure-key-vault.retry-policy.mode fixed

--azure-key-vault.retry-policy.max-count

設定最大重試次數。

Example

dab configure \
  --azure-key-vault.retry-policy.max-count 5

--azure-key-vault.retry-policy.delay-seconds

將重試間隔設定為幾秒鐘。

Example

dab configure \
  --azure-key-vault.retry-policy.delay-seconds 2

--azure-key-vault.retry-policy.max-delay-seconds

在指數模式下,設定重試間最大延遲以秒為單位。

Example

dab configure \
  --azure-key-vault.retry-policy.max-delay-seconds 30

--azure-key-vault.retry-policy.network-timeout-seconds

設定網路逾時,請求時間為幾秒。

Example

dab configure \
  --azure-key-vault.retry-policy.network-timeout-seconds 20

產生的設定

{
  "azure-key-vault": {
    "retry-policy": {
      "mode": "fixed",
      "max-count": 5,
      "delay-seconds": 2,
      "max-delay-seconds": 30,
      "network-timeout-seconds": 20
    }
  }
}

--runtime.telemetry.azure-log-analytics.enabled

啟用或停用 Azure Log Analytics。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.enabled true

--runtime.telemetry.azure-log-analytics.dab-identifier

設定 Azure Log Analytics 中使用的 DAB 識別字串。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.dab-identifier MyDab

--runtime.telemetry.azure-log-analytics.flush-interval-seconds

為 Azure Log Analytics 設定秒數沖洗間隔。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.flush-interval-seconds 10

--runtime.telemetry.azure-log-analytics.auth.custom-table-name

為 Azure Log Analytics 設定自訂資料表名稱。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.auth.custom-table-name MyDabLogs

--runtime.telemetry.azure-log-analytics.auth.dcr-immutable-id

Configure DCR immutable ID for Azure Log Analytics.

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.auth.dcr-immutable-id dcr-123

--runtime.telemetry.azure-log-analytics.auth.dce-endpoint

為 Azure Log Analytics 配置 DCE 端點。

Example

dab configure \
  --runtime.telemetry.azure-log-analytics.auth.dce-endpoint https://example.eastus-1.ingest.monitor.azure.com

產生的設定

{
  "runtime": {
    "telemetry": {
      "azure-log-analytics": {
        "enabled": true,
        "auth": {
          "custom-table-name": "MyDabLogs",
          "dcr-immutable-id": "dcr-123",
          "dce-endpoint": "https://example.eastus-1.ingest.monitor.azure.com"
        },
        "dab-identifier": "MyDab",
        "flush-interval-seconds": 10
      }
    }
  }
}

--runtime.telemetry.file.enabled

啟用或關閉檔案匯入記錄。

Example

dab configure \
  --runtime.telemetry.file.enabled true

--runtime.telemetry.file.path

設定檔案匯入記錄的路徑。

Example

dab configure \
  --runtime.telemetry.file.path C:\\logs\\dab-log.txt

--runtime.telemetry.file.rolling-interval

設定檔案匯入記錄的滾動間隔。

允許的值:

  • Minute
  • Hour
  • Day
  • Month
  • Year
  • Infinite

Example

dab configure \
  --runtime.telemetry.file.rolling-interval Month

--runtime.telemetry.file.retained-file-count-limit

設定保留檔案的最大數量。

Example

dab configure \
  --runtime.telemetry.file.retained-file-count-limit 5

--runtime.telemetry.file.file-size-limit-bytes

設定最大檔案大小限制(以位元組為單位)。

Example

dab configure \
  --runtime.telemetry.file.file-size-limit-bytes 2097152

產生的設定

{
  "runtime": {
    "telemetry": {
      "file": {
        "enabled": true,
        "path": "C:\\logs\\dab-log.txt",
        "rolling-interval": "Month",
        "retained-file-count-limit": 5,
        "file-size-limit-bytes": 2097152
      }
    }
  }
}

--help

顯示此說明畫面。

Example

dab configure \
  --help

--version

顯示版本資訊。

Example

dab configure \
  --version