Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 16424e6

Browse files
authored
feat: APIM example doc (#225)
1 parent 4e46a03 commit 16424e6

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ The getting started walkthrough illustrates the interactive login experience, wh
200200
$env:azureServicePrincipalPassword='<password>'
201201
```
202202

203+
### Example Usage
204+
- [Configuring API Management](docs/examples/apim.md) that sits in front of function app
205+
203206
### Contributing
204207

205208
Please create issues in this repo for any problems or questions you find. Before sending a PR for any major changes, please create an issue to discuss.

docs/examples/apim.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# API Management
2+
3+
[API Management](https://azure.microsoft.com/en-us/services/api-management/) is an Azure Service for publishing, managing, securing and monitoring APIs. It can be deployed along with your Serverless function app by specifying its configuration in `serverless.yml`. Here is a basic example of how to configure API Mangement:
4+
5+
## Simple Handler
6+
7+
```yaml
8+
service: greeter
9+
10+
provider:
11+
prefix: greeter
12+
name: azure
13+
# Default to West US, allow for command line arg --region to override
14+
region: ${opt:region, 'westus'}
15+
# Default to dev, allow for command line arg -- stage to override
16+
stage: ${opt:stage, 'dev'}
17+
# Azure subscription ID for deployment
18+
subscriptionId: 00000000-0000-0000-0000-000000000000
19+
20+
# Start of your API Management configuration
21+
apim:
22+
# API specifications
23+
api:
24+
# Name of the API
25+
name: v1
26+
subscriptionRequired: false
27+
# Display name
28+
displayName: v1
29+
# Description of API
30+
description: V1 sample app APIs
31+
# HTTP protocols allowed
32+
protocols:
33+
- https
34+
# Base path of API calls
35+
path: v1
36+
# Tags for ARM resource
37+
tags:
38+
- tag1
39+
- tag2
40+
# No authorization
41+
authorization: none
42+
# CORS Settings for APIM
43+
cors:
44+
allowCredentials: false
45+
allowedOrigins:
46+
- "*"
47+
allowedMethods:
48+
- GET
49+
- POST
50+
- PUT
51+
- DELETE
52+
- PATCH
53+
allowedHeaders:
54+
- "*"
55+
exposeHeaders:
56+
- "*"
57+
58+
plugins:
59+
- serverless-azure-functions
60+
61+
functions:
62+
hello:
63+
handler: src/handlers/hello.handler
64+
65+
# API Management configuration for `hello` handler
66+
apim:
67+
operations:
68+
# GET operation for `hello` handler
69+
- method: get
70+
# URL path for accessing handler
71+
urlTemplate: /hello
72+
# Display name inside Azure Portal
73+
displayName: Hello
74+
events:
75+
- http: true
76+
x-azure-settings:
77+
methods:
78+
- GET
79+
authLevel : function
80+
- http: true
81+
x-azure-settings:
82+
direction: out
83+
name: res
84+
```

0 commit comments

Comments
 (0)