1. Packages
  2. Azure Classic
  3. How-to Guides
  4. Azure API Management

We recommend using Azure Native.

Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi

Azure API Management

azure logo

We recommend using Azure Native.

Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi

    View Code Deploy

    An example Pulumi program that deploys an instance of Azure API Management with the following resources:

    • API which is linked to an Azure Function App backend
    • Operation and operation policy with URL rewrite and caching rules
    • A product, a user, and a subscription to enable access to the API

    Running the App

    1. Create a new stack:

      $ pulumi stack init dev
      
    2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

      $ az login
      
    3. Restore NPM dependencies:

      $ npm install
      
    4. Configure Azure location:

      $ pulumi config set azure:location <location>
      
    5. Run pulumi up to preview and deploy changes:

      $ pulumi up
      Previewing update (dev):
      ...
      
      Updating (dev):
      ...
      Resources:
         + 12 created
      Duration: 34m54s
      
    6. Check the deployed function endpoint:

      $ pulumi stack output endpoint
      https://greeting-service12345678.azure-api.net/hello/Pulumi
      $ curl --header "Ocp-Apim-Subscription-Key: $(pulumi stack output key)" $(pulumi stack output endpoint)
      {"time":"2019-06-17T15:16:08.227Z","greeting":"Hello Pulumi!"}
      ...
      
    7. Verify that API caches the response for 30 seconds - the same time should be returned for subsequent queries:

      $ curl --header "Ocp-Apim-Subscription-Key: $(pulumi stack output key)" $(pulumi stack output endpoint)
      {"time":"2019-06-17T15:16:08.227Z","greeting":"Hello Pulumi!"}
      ...
      
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi