ApiCenterOnboardingPlugin

Checks if the APIs used in an app are registered in the specified Azure API Center instance.

Screenshot of a command prompt showing Dev Proxy checking if the recorded API requests are registered in Azure API Center.

Configuration example

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/rc.schema.json",
  "plugins": [
    {
      "name": "ApiCenterOnboardingPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "apiCenterOnboardingPlugin"
    }
  ],
  "apiCenterOnboardingPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/apicenteronboardingplugin.schema.json",
    "subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
    "resourceGroupName": "resource-group-name",
    "serviceName": "apic-instance",
    "workspaceName": "default",
    "createApicEntryForNewApis": true
  }
}

Configuration properties

Property Description Default
createApicEntryForNewApis Set to true to have Dev Proxy create new API entries for the APIs that it detected and which aren't yet registered in API Center. When set to false Dev Proxy only lists the unregistered APIs in the command prompt. true
resourceGroupName Name of the resource group where the Azure API Center is located. None
serviceName Name of the Azure API Center instance that Dev Proxy should use to check if the APIs used in the app are registered. None
subscriptionId ID of the Azure subscription where the Azure API Center instance is located. None
workspaceName Name of the Azure API Center workspace to use. default

Command line options

None

Remarks

The ApiCenterOnboardingPlugin plugin checks if the APIs used in an app are registered in the specified Azure API Center instance. If the APIs aren't registered, the plugin can create new API entries in the API Center instance.

To connect to Azure API Center, the plugin uses Azure credentials (in this order):

  • Environment
  • Workload Identity
  • Managed Identity
  • Visual Studio
  • Visual Studio Code
  • Azure CLI
  • Azure PowerShell
  • Azure Developer CLI

If the plugin fails to get an access token to access Azure, it shows an error and Dev Proxy disables it. Sign in to Azure using either of these tools, and restart Dev Proxy to use the ApiCenterOnboardingPlugin plugin.

If you use Dev Proxy in CI/CD pipelines, you can pass values for the subscriptionId, resourceGroupName, serviceName, and workspaceName properties as environment variables. To reference an environment variable, use the ${VAR_NAME} placeholder, for example:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/rc.schema.json",
  "plugins": [
    {
      "name": "ApiCenterOnboardingPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "apiCenterOnboardingPlugin"
    }
  ],
  "apiCenterOnboardingPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/apicenteronboardingplugin.schema.json",
    "subscriptionId": "${AZURE_SUBSCRIPTION_ID}",
    "resourceGroupName": "${AZURE_RESOURCE_GROUP_NAME}",
    "serviceName": "${AZURE_APIC_INSTANCE_NAME}",
    "workspaceName": "${AZURE_APIC_WORKSPACE_NAME}",
    "createApicEntryForNewApis": true
  }
}

In this example, the ApiCenterOnboardingPlugin plugin sets subscriptionId, resourceGroupName, serviceName, and workspaceName properties to the values of the AZURE_SUBSCRIPTION_ID, AZURE_RESOURCE_GROUP_NAME, AZURE_APIC_INSTANCE_NAME, and AZURE_APIC_WORKSPACE_NAME environment variables, respectively.

If an environment variable referenced in the configuration isn't set, Dev Proxy leaves the placeholder as-is and logs a warning, for example Environment variable AZURE_SUBSCRIPTION_ID referenced in /Users/user/devproxyrc.json isn't set. Leaving the placeholder as-is. For more information, see Use environment variables in configuration files.

Note

Earlier versions of Dev Proxy referenced environment variables by prefixing the variable name with @, for example "subscriptionId": "@AZURE_SUBSCRIPTION_ID". This syntax still works but is deprecated and Dev Proxy logs a warning when you use it. If an environment variable referenced using @ isn't set or is empty, the plugin shows an error, for example Environment variable AZURE_SUBSCRIPTION_ID referenced by subscriptionId isn't set., and Dev Proxy disables it. Use ${VAR_NAME} instead.

Next step