次の方法で共有


ApiCenterProductionVersionプラグイン

アプリで使用される API が、指定された Azure API センター インスタンスに登録されている API の実稼働バージョンであるかどうかを確認します。

記録された API 要求が Azure API センターに登録されている運用バージョンの API と一致するかどうかを確認する開発プロキシを示すコマンド プロンプトのスクリーンショット。

プラグイン インスタンスの定義

{
  "name": "ApiCenterProductionVersionPlugin",
  "enabled": true,
  "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
  "configSection": "apiCenterProductionVersionPlugin"
}

構成の例

{
  "apiCenterProductionVersionPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.29.1/apicenterproductionversionplugin.schema.json",
    "subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
    "resourceGroupName": "resource-group-name",
    "serviceName": "apic-instance",
    "workspaceName": "default"
  }
}

構成プロパティ

財産 形容 デフォルト
resourceGroupName Azure API Center が配置されているリソース グループの名前。 何一つ
serviceName アプリで使用される API が登録されているかどうかを確認するためにデベロッパー プロキシが使用する必要がある Azure API センター インスタンスの名前。 何一つ
subscriptionId Azure API Center インスタンスが配置されている Azure サブスクリプションの ID。 何一つ
workspace 使用する Azure API Center ワークスペースの名前。 default

コマンド ライン オプション

何一つ

備考

ApiCenterProductionVersionPlugin プラグインは、アプリで使用される API が、指定された Azure API センター インスタンスに登録されている API の実稼働バージョンであるかどうかを確認します。 API が非運用環境のバージョンと一致する場合、プラグインには警告が表示されます。

Azure API Center に接続するために、プラグインは (この順序で) Azure 資格情報を使用します。

  • 環境
  • ワークロード ID
  • マネージド ID
  • Visual Studio
  • Visual Studio Code
  • Azure CLI(Azure コマンドライン インターフェイス)
  • Azure PowerShell
  • Azure 開発者コマンドラインインターフェース

プラグインが Azure にアクセスするためのアクセス トークンを取得できない場合は、エラーが表示され、Dev Proxy によって無効になります。 これらのツールのいずれかを使用して Azure にサインインし、開発プロキシを再起動して ApiCenterProductionVersionPlugin プラグインを使用します。

CI/CD パイプラインで開発プロキシを使用する場合は、subscriptionIdresourceGroupNameserviceName、および workspaceName プロパティの値を環境変数として渡すことができます。 環境変数を使用するには、値の名前の前に @を付けます。次に例を示します。

{
  "apiCenterProductionVersionPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.29.1/apicenterproductionversionplugin.schema.json",
    "subscriptionId": "@AZURE_SUBSCRIPTION_ID",
    "resourceGroupName": "@AZURE_RESOURCE_GROUP_NAME",
    "serviceName": "@AZURE_APIC_INSTANCE_NAME",
    "workspaceName": "@AZURE_APIC_WORKSPACE_NAME"
  }
}

この例では、ApiCenterProductionVersionPlugin プラグインは、subscriptionIdresourceGroupNameserviceName、および workspaceName プロパティをそれぞれ、AZURE_SUBSCRIPTION_IDAZURE_RESOURCE_GROUP_NAMEAZURE_APIC_INSTANCE_NAME、および AZURE_APIC_WORKSPACE_NAME 環境変数の値に設定します。

次のステップ