From 803df7211bb4dad23486b806671dfe0cd258c823 Mon Sep 17 00:00:00 2001 From: Jastinder Singh Atwal Date: Wed, 5 Dec 2018 00:57:04 +0000 Subject: [PATCH] Example Usage using the Azure CLI (#16) * create example page and reference from readme --- Example.md | 36 ++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 Example.md diff --git a/Example.md b/Example.md new file mode 100644 index 00000000..b6a68d61 --- /dev/null +++ b/Example.md @@ -0,0 +1,36 @@ +# Example deployment using the Azure CLI + +The following instructions demonstrate how to deploy the contents of this example repository using the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest). + +#### Changing the `ApimServiceName` template parameter + +Note that throughout the following steps, the ARM template parameter `ApimServiceName` will need to be unique. If you use the default of `contosoapim-dev` that is used in these templates you will get the following error: + +``` +Deployment failed. Correlation ID: { + "code": "ServiceAlreadyExists", + "message": "Api service already exists: contosoapim-dev", + "details": null, + "innerError": null +} +``` + +## Instructions + +Login to your Azure subscription: + +`az login` + +Create a new resource group `apim-rg` that will be used to deploy an APIM instance: + +`az group create -n apim-rg -l westeurope` + +Deploy the _service template_ to host the APIM _instance_ (note this command can take several minutes to complete): + +`az group deployment create --resource-group apim-rg --template-file ./example/service.template.json --parameters ./example/service.parameters.json` + +Deploy the `api-httpbin` _API template_ to create an API in the APIM instance: + +`az group deployment create --resource-group apim-rg --template-file ./example/api-httpbin/api-httpbin.template.json --parameters ./example/api-httpbin/api-httpbin.parameters.json` + +It is of interest the command to create the `api-httpbin` API uses an Open API (swagger) specification `api-httpbin.openapi.json` file when creating the API. \ No newline at end of file diff --git a/README.md b/README.md index de15dbcf..843f04a3 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ Once the changes are merged successfully, then _API publishers_ can deploy them 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. +We have provided an [example](Example.md) on how to use this approach and deploy using the Azure CLI. + 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. 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.