แก้ไข

แชร์ผ่าน


Import a gRPC API

APPLIES TO: Developer | Premium

This article shows how to import a gRPC service definition as an API in API Management. You can then manage the API in API Management, secure access and apply other polices, and pass gRPC API requests through the gateway to the gRPC backend.

To add a gRPC API to API Management, you need to:

  • Upload the API's Protobuf (protocol buffer) definition file to API Management
  • Specify the location of your gRPC service
  • Configure the API in API Management

API Management supports pass-through with the following types of gRPC service methods: unary, server streaming, client streaming, and bidirectional streaming. For background about gRPC, see Introduction to gRPC.

Note

  • Currently, gRPC APIs are only supported in the self-hosted gateway, not the managed gateway for your API Management instance.
  • Currently, testing gRPC APIs isn't supported in the test console of the Azure portal or in the API Management developer portal.
  • Import is limited to a single Protobuff (.proto) file.

Prerequisites

Add a gRPC API

  1. In the Azure portal, navigate to your API Management instance.

  2. In the left menu, select APIs > + Add API.

  3. Under Define a new API, select gRPC.

    Screenshot of creating a gRPC API in the portal.

  4. In the Create a gRPC API window, select Full.

  5. For a gRPC API, you must specify the following settings:

    1. In Upload schema, select a local .proto file associated with the API to import.

    2. In gRPC server URL, enter the address of the gRPC service. The address must be accessible over HTTPS.

    3. In Gateways, select the gateway resource that you want to use to expose the API.

      Important

      In public preview, you can only select a self-hosted gateway. The Managed gateway isn't supported.

  6. Enter remaining settings to configure your API. These settings are explained in the Import and publish your first API tutorial.

  7. Select Create.

    The API is added to the APIs list. You can view update your settings by going to the Settings tab of the API.

Call gRPC services with .NET

For information about calling gRPC services with .NET, see the following articles:

Append other APIs

You can compose an API of APIs exposed by different services, including:

  • An OpenAPI specification
  • A SOAP API
  • A GraphQL API
  • A Web App hosted in Azure App Service
  • Azure Function App
  • Azure Logic Apps
  • Azure Service Fabric

Append a different API to your existing API using the following steps.

Note

When you import another API, the operations are appended to your current API.

  1. Go to your Azure API Management instance in the Azure portal.

    Go to Azure API Mgmt instance

  2. Select APIs on the Overview page or from the menu on the left.

    Select APIs

  3. Click ... next to the API that you want to append another API to.

  4. Select Import from the drop-down menu.

    Select import

  5. Select a service from which to import an API.

    Select service