Skip to content

Azure-Samples/azd-apic-sap

Repository files navigation

page_type languages products urlFragment name description
sample
azdeveloper
bicep
xml
azure-api-management
azure-api-center
azure-key-vault
azure-log-analytics
azure-monitor
azd-apic-sap
Discover your SAP & Azure API Management APIs in one place with Azure API Center
Improve the discoverability and governance of all your APIs in one place, with Azure API Center. In this sample we expose SAP APIs directly and Azure API Management APIs connected to an SAP OData backend to API Center, deployed with Azure Developer CLI (azd)

Open in GitHub Codespaces Open in Dev Container

Discover your SAP & Azure API Management APIs in one place with Azure API Center

Improve the discoverability and governance of all your APIs in one place, with Azure API Center. In this sample we expose SAP APIs directly and Azure API Management APIs connected to an SAP OData backend to API Center, deployed with Azure Developer CLI (azd).

This repository provides guidance and tools for organizations looking to implement Azure API Center to improve the discoverability and governance of all APIs in one place. The repository includes a Bicep template for provisioning and deploying the resources, and a sample API implementation that demonstrates how to expose SAP APIs directly and Azure API Management APIs connected to an SAP OData backend to API Center.

Tip

Have a look at this blog post for more details on the approach.

Key features ⚙️

  • Infrastructure-as-code: Bicep templates for provisioning and deploying the resources.
  • API Inventory: Register all of your organization's APIs for inclusion in a centralized inventory.
  • API Covernance: Organize and filter APIs and related resources using built-in and custom metadata properties, to help with API governance and discovery by API consumers. Set up linting and analysis to enforce API definition quality.
  • API Discovery: Enable developers and API program managers to discover APIs via the Azure portal, an API Center portal, and developer tools including a Visual Studio Code extension integrated with GitHub Copilot.
  • SAP Integration: Expose your SAP backend via Azure API Management or via SAP API Management to Azure API Center.
  • End-to-end sample: Including dashboards, sample APIs and Developer Portals.

Architecture 🏛️

azd-apic-sap Read more: Architecture in detail

Assets 📦

  • Infrastructure-as-code (IaC) Bicep files under the infra folder that demonstrate how to provision resources and setup resource tagging for azd.
  • A dev container configuration file under the .devcontainer directory that installs infrastructure tooling by default. This can be readily used to create cloud-hosted developer environments such as GitHub Codespaces or a local environment via a VSCode DevContainer.
  • Continuous deployment workflows for CI providers such as GitHub Actions under the .github directory, and Azure Pipelines under the .azdo directory that work for most use-cases.

Getting started 🛫

Prerequisites (steps not that are not automated by AZD)

Tip

Consider the SAP BTP terraform provider to automate the provisioning of SAP BTP services for a fully integrated experience. Find more information here.

Preparing your SAP APIs in Azure API Management

Arguably the fastest way to interact with an SAP OData API is the SAP Business Accelerator hub. Once signed up you can tryout for instance Business Partner API here. You'll find the API documentation here.

See these additional options for free and easy sandboxing with SAP APIs.

Find more information about on adding OData APIs in Azure API Management here. For SAP API Management have a look here.

1. Initialize a new azd environment

azd init -t azure-samples/azd-apic-sap

If you already cloned this repository to your local machine or run from a Dev Container or GitHub Codespaces you can run the following command from the root folder.

azd init

It will prompt you to provide a name that will later be used in the name of the deployed resources. If you're not logged into Azure, it will also prompt you to first login.

azd auth login

2. Provision and deploy all the resources

azd up

It will prompt you to login, pick a subscription, and provide a location (like "eastus"). We've added extra conditional parameters to optionally deploy: ...

For more details on the deployed services, see additional details below.

The conditional parameters set in the azd up command are stored in the .azure<name>\config.json file:

{
  "infra": {
    "parameters": {
      "deployAzureAPIMtoAPIC": "<true or false>", // Deploy Azure API Management APIs to API Center
      "deploySapAPIMtoAPIC": "<true or false>", // Deploy SAP API Management APIs to API Center
      // SAP API Management
      "sapApimTokenUrl": "<https://<your-sap-btp-service-instance-name>.authentication.<btp-region>.hana.ondemand.com/oauth/token>", // url property from SAP BTP service key
      "sapApimDiscoveryUrl": "<https://<btp-region>devportal.cfapps.<btp-region>.hana.ondemand.com/apidiscovery/v1/apis>", // The SAP API Management discovery URL
      "sapApimClientId": "<client id from SAP BTP service key>", // SAP API Management, developer portal
      "sapApimSecret": "<client secret from SAP BTP service key>", // SAP API Management, developer portal
      // Azure API Management specific for included automatic onboarding of OData API into Azure APIM
      "sapBackendEndpoint": "<SAP OData endpoint for Azure API Management>", // The SAP OData endpoint for Azure API Management
      "sapBackendApiKey": "<API key for Azure API Management solution>" // The SAP OData api key for API Azure Management
    }
  }
}

Note

Deploy only SAP API Management APIs to Azure API Center skipping Azure API Management APIs, by setting the deployAzureAPIMtoAPIC parameter to false. All input related to Azure API Management will be ignored. Same applies for the deploySapAPIMtoAPIC parameter for the SAP API Management APIs.

Testing 🧪

  • Use the test file tests-sap-backend.http to check your Azure API Management deployment consuming from SAP Backend.

  • Testing the SAP API Management Discovery can be done using the file sap-apim-scan.http.

  • Check the environment variables in the .env file, or run the command below in the terminal. Keep in mind that secrets are not stored in the .env file, so you need to provide them manually.

azd env get-values

What's next?

You can do a lot more once the app is deployed. Curious? We got you covered with some more information on the setup, monitoring, and DevOps here.

Contributing 👩🏼‍🤝‍👨🏽

This project welcomes contributions and suggestions. Please use GitHub Issues to report errors or request new features.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks™

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.