|
2 | 2 |
|
3 | 3 | # Azure API Management DevOps Example
|
4 | 4 |
|
5 |
| -This repository contains examples and tools to help you achieve API DevOps with Azure API Management. |
| 5 | +This repository contains guidance, examples, and tools to help you achieve API DevOps with Azure API Management. |
6 | 6 |
|
7 | 7 | ## Background
|
8 | 8 |
|
9 |
| -Organizations today often have multiple deployment environments (e.g., development, QA, production) and use separate API Management (APIM) instances for each environment. In some cases, those APIM instances are shared by a number of API development teams, each responsible for one or more APIs. It becomes a challenge for organizations to automate deployment of APIs into a shared environment without interference between the teams and/or impact on API consumers. |
| 9 | +Organizations today usually have multiple deployment environments (e.g., development, QA, production) and use separate Azure API Management (APIM) instances for each environment. It is also not uncommon for an APIM instance to be shared by multiple API development teams. Each of these teams is responsible for one or more APIs and has a different release cadence. As a result, organizations who are using APIM often come to us with the following questions: |
10 | 10 |
|
11 |
| -In this repository, we propose an approach for the problem along with examples and tools to implement the solution. |
| 11 | +1. How to automate deployment of APIs into APIM |
| 12 | +2. How to promote APIM configurations from one environment to another |
| 13 | +3. How to prevent interference between API teams |
| 14 | + |
| 15 | +In the next section, we propose an approach that aims to address all these questions. |
12 | 16 |
|
13 | 17 | ## API DevOps with API Management
|
14 | 18 |
|
15 |
| -The proposed approach is shown in the below picture. |
| 19 | +The proposed approach is illustrated in the below picture. |
16 | 20 |
|
17 | 21 | 
|
18 | 22 |
|
19 | 23 | In this example, there are two deployment environments: _Development_ and _Production_, each environment has its own APIM instance. _API developers_ have access to the _Development_ instance and can use it for developing and testing their APIs. The _Production_ instance is managed by a designated team called the _API publishers_.
|
20 | 24 |
|
21 |
| -The key in this proposed solution is to keep all your APIM configurations in Azure Resource Manager (ARM) templates under your SCM systems. In this example, we use GIT. There is a _Publisher repository_ that contains all the configurations of the _Production_ instance. _API developers_ can fork and clone the _Publisher repository_ and then start working on their APIs in their own repository. |
22 |
| - |
23 |
| -There are three types of ARM templates: the _Service template_ contains all the configurations related to the APIM instance (e.g., sku type, custom URL). The _Shared templates_ contain shared resources (e.g., groups, products). For each API, there is an _API template_ that contains all the configurations related to the API and its sub-resources (e.g., API definition, operations, policies). |
| 25 | +The key in this proposed approach is to keep all APIM configurations in Azure [Resource Manager templates](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-authoring-templates). The templates should be kept in an [SCM](https://en.wikipedia.org/wiki/Software_configuration_management) system. We will use GIT throughout this example. As illustrated in the picture, there is a _Publisher repository_ that contains all the configurations of the _Production_ APIM instance. _API developers_ can fork and clone the _Publisher repository_ and work on their APIs in their _Developer repository_. |
24 | 26 |
|
25 |
| -Finally, The _Master template_ ties everything together by linking to all templates and deploy them in order. Therefore, if you want to deploy everything to an APIM instance, you can simply deploy the _Master template_. A beautiful thing is that each template can also be deployed individually. For example, if you just want to deploy a single API. |
| 27 | +There are three types of templates: the _Service template_ contains all the service-level configurations of the APIM instance (e.g., pricing tier and custom domains). The _Shared templates_ contain shared resources throughout an APIM instance (e.g., groups, products, loggers). For each API, there is an _API template_ that contains all the configurations of the API and its subresources (e.g., API definition, operations, policies, diagnostics settings). Finally, the _Master template_ ties everything together by [linking](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-linked-templates) to all templates and deploy them in order. Therefore, if we want to deploy all configurations to an APIM instance, we can deploy the _Master template_. We can also choose to deploy each template individually. For instance, if we just want to deploy changes to an API. |
26 | 28 |
|
27 |
| -_API developers_ normally work with Open API (aka., Swagger) files for defining their APIs. One challenge for them is authoring the _API templates_, which might be an error-prone task for people not familiar with ARM template formats. Therefore, we will create and open source an **ARM template generator** to help you generate _API templates_ based on Open API (aka., Swagger) files and policy files. Basically, the generator will extract your API and operation definitions from an Open API file and insert them into an ARM template in the proper format. It will also extract policies from an XML file and inline the policies into the template. With this tool, _API developers_ can continue focusing on the formats they are familiar with. |
| 29 | +There are two obvious challenges of this approach with Resource Manager templates. _API developers_ often work with Open API (formerly known as Swagger) specifications to define their APIs. The first challenge for them is authoring _API templates_, which might be error-prone for people not familiar with Resource Manager templates schema. To tackle this challenge, we will create a template generator** to help developers generate _API templates_ based on Open API specifications. Optionally, developers can also supply APIM policies for an API in XML format. Basically, the tool inserts the Open API specification and policies into a Resource Manager template in the proper format. With this tool, _API developers_ can continue focusing on the formats they are familiar with. For customers who have already been using APIM, the second challenge is how to extract existing configurations into Resource Manager templates. For those customers, we will provide a **second template generator** to help them create _API templates_ by extracting configurations from their existing APIM instances. The tools will be open source and provided through this repository. Customers can extend and customize the tools to their needs. |
28 | 30 |
|
29 |
| -If you already have APIs published by APIM, or if you prefer using the Admin UX for configuring your APIs, we will also provide a **second ARM template generator** to help you generate _API templates_ by extracting configurations from an existing APIM instance. Likewise, this generator will also be open sourced. |
| 31 | +Once _API developers_ finish developing and testing an API, and have generated the _API template_ for it, they can submit a pull request to merge the changes to the _Publisher repository_. _API publishers_ can validate the pull request and make sure the changes are safe and compliant. Most of the validations can be automated as part of the CI/CD pipeline. Once the changes are approved and merged successfully, _API publishers_ can choose to deploy them to the _Production_ instance either on schedule or on demand. We have provided an [example](Example.md) on how to deploy the templates using Azure CLI. |
30 | 32 |
|
31 |
| -When _API developers_ finish develop and test an API, and have generated the _API template_ for it, they can submit a pull request to merge the changes back to the _Publisher repository_. _API publishers_ can validate the pull request to make sure the changes are safe and compliant to the corporate standards. Most of the validations can be automated as part of the CI/CD pipeline. |
| 33 | +With this approach, the deployment of API changes into APIM instances can be automated and it is easy to promote changes from one environment to another. Since different API development teams will be working on different sets of API templates and files, it prevents interference between different teams. |
32 | 34 |
|
33 |
| -Once the changes are merged successfully, then _API publishers_ can deploy them to the _Production_ instance either on schedule or on request. |
| 35 | +We realize our customers bring a wide range of engineering cultures and existing automation solutions. The approach and tools provided here are not meant to be a one-size-fits-all solution. That's why we created this repository and open-sourced everything, so that you can extend and customize the solution. |
34 | 36 |
|
35 |
| -With this approach, it is easy to migrate changes from one environment to another. Also, since different API development teams will be working on different sets of API templates and files, it also prevents them from colliding with each other. |
| 37 | +If you have any questions or feedback, please raise issues in the repository or email us at apimgmt at microsoft. We also started an [FAQ page](./FAQ.md) to answer most common questions. |
36 | 38 |
|
37 |
| -We have provided an [example](Example.md) on how to use this approach and deploy using the Azure CLI. |
| 39 | +## Alternatives |
38 | 40 |
|
39 |
| -We realize our customers bring a wide range of engineering cultures and existing automation solutions. The approach proposed here is not meant to be a one-size-fits-all solution. That's the reason we created this repository and open sourced everything, so that you can extend and custom the solution. |
| 41 | +For customers who are just starting out or have simple scenarios, they may not necessarily need to use the template generator and may found it easier to begin with the boilerplate templates we provided in the [example](./example/) folder. |
40 | 42 |
|
41 |
| -If you have any questions or feedback, please raise issues in the repository or email us at apimgmt at microsoft dotcom. We also started an [FAQ page](./FAQ.md) to answer most common questions. |
| 43 | +Customers can also run [PowerShell](https://docs.microsoft.com/powershell/module/azurerm.apimanagement/?view=azurermps-6.13.0) scripts as part of their release process to deploy APIs to APIM. There is also a **non-official** Azure DevOps [extension](https://marketplace.visualstudio.com/items?itemName=stephane-eyskens.apim) created by Azure MVP [Stephane Eyskens]((https://stephaneeyskens.wordpress.com/). |
42 | 44 |
|
43 | 45 | ## License
|
44 | 46 |
|
45 | 47 | This project is licensed under [the MIT License](LICENSE)
|
46 | 48 |
|
47 |
| -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
| 49 | +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
48 | 50 |
|
49 | 51 | ## Contributing
|
50 | 52 |
|
51 |
| -This project welcomes contributions and suggestions. Most contributions require you to agree to a |
52 |
| -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us |
53 |
| -the rights to use your contribution. For details, visit https://cla.microsoft.com. |
| 53 | +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. |
54 | 54 |
|
55 |
| -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide |
56 |
| -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions |
57 |
| -provided by the bot. You will only need to do this once across all repos using our CLA. |
| 55 | +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. |
58 | 56 |
|
59 | 57 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
60 |
| -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or |
61 |
| -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
| 58 | +For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
0 commit comments