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

Commit 545ff24

Browse files
committed
Merge branch 'master' of https://github.com/Azure/azure-api-management-devops-example into lucashh-writeresourcetemplates
2 parents 707f54c + 3101072 commit 545ff24

11 files changed

+287
-16
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"value": "contoso-dev"
7+
},
8+
"ClientID": {
9+
"value": "ClientID"
10+
},
11+
"ClientSecret": {
12+
"value": "<ClentSecret>"
13+
},
14+
"allowedTenants": {
15+
"value": "<tenant>"
16+
}
17+
}
18+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"type": "string"
7+
},
8+
"ClientID": {
9+
"type": "string"
10+
},
11+
"ClientSecret": {
12+
"type": "string"
13+
},
14+
"allowedTenants": {
15+
"type": "string"
16+
}
17+
},
18+
"resources": [
19+
{
20+
"type": "Microsoft.ApiManagement/service/identityProviders",
21+
"name": "[concat(parameters('ApimServiceName'), '/aad')]",
22+
"apiVersion": "2018-01-01",
23+
"properties": {
24+
"clientId": "[parameters('ClientID')]",
25+
"clientSecret": "[parameters('ClientSecret')]",
26+
"type": "aad",
27+
"allowedTenants": [
28+
"[parameters('allowedTenants')]"
29+
]
30+
}
31+
}
32+
]
33+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"value": "contoso-dev"
7+
},
8+
"ClientID": {
9+
"value": "<ClientID>"
10+
},
11+
"ClientSecret": {
12+
"value": "<ClientSecret>"
13+
},
14+
"IdentityType": {
15+
"value": "facebook"
16+
}
17+
}
18+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"type": "string"
7+
},
8+
"ClientID": {
9+
"type": "string"
10+
},
11+
"ClientSecret": {
12+
"type": "string"
13+
},
14+
"IdentityType": {
15+
"type": "string",
16+
"allowedValues": [
17+
"facebook",
18+
"google",
19+
"microsoft",
20+
"twitter"
21+
]
22+
}
23+
},
24+
"resources": [
25+
{
26+
"type": "Microsoft.ApiManagement/service/identityProviders",
27+
"name": "[concat(parameters('ApimServiceName'), '/',parameters('IdentityType'))]",
28+
"apiVersion": "2018-01-01",
29+
"properties": {
30+
"clientId": "[parameters('ClientID')]",
31+
"clientSecret": "[parameters('ClientSecret')]",
32+
"type": "[parameters('IdentityType')]"
33+
}
34+
}
35+
]
36+
}

example/diagnostics/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Integration: Application Insights
2+
3+
This ARM template integrates an existing API Management instance to new Application Insights instance.
4+
5+
**Instructions:**
6+
1. Clone this repo
7+
2. Using a command-line tool, navigate to the `example/diagostics` directory
8+
3. Run following Azure CLI command to start the process:
9+
10+
`az group deployment create --resource-group <resource-group> --template-file ./application-insights.template.json --parameters ApimServiceName=<apim-instance-name> --parameters @application-insights.parameters.json`
11+
12+
Note: be sure to replace `<resource-group>`as well as `<apim-instance-name>` with their corresponding parameters and update the `application-insights.parameters.json` file with appropriate parameters that pertain to your environment.
13+
4. Once completed, your existing API Management instance should be integrated with a newly created Application Insights instance as described in: [How to integrate Azure API Management with Azure Application Insights](https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-app-insights)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema":
3+
"http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
4+
"contentVersion": "1.0.0.0",
5+
"parameters": {
6+
"ApplicationInsightsLocation": {
7+
"value": "westus2"
8+
},
9+
"ApplicationInsightsInstanceName": {
10+
"value": "contoso-appinsights"
11+
},
12+
"SamplingRate": {
13+
"value": 50
14+
}
15+
}
16+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"type": "string"
7+
},
8+
"ApplicationInsightsLocation": {
9+
"type": "string"
10+
},
11+
"ApplicationInsightsInstanceName": {
12+
"type": "string"
13+
},
14+
"SamplingRate": {
15+
"type": "int"
16+
}
17+
},
18+
"variables": {},
19+
"resources": [
20+
{
21+
"name": "[parameters('ApplicationInsightsInstanceName')]",
22+
"type": "Microsoft.Insights/components",
23+
"apiVersion": "2015-05-01",
24+
"location": "[parameters('ApplicationInsightsLocation')]",
25+
"tags": {},
26+
"kind": "other",
27+
"properties": {
28+
"Application_Type": "other"
29+
}
30+
},
31+
{
32+
"type": "Microsoft.ApiManagement/service/loggers",
33+
"name": "[concat(parameters('ApimServiceName'), '/', parameters('ApplicationInsightsInstanceName'))]",
34+
"apiVersion": "2018-06-01-preview",
35+
"properties": {
36+
"loggerType": "applicationInsights",
37+
"description": "Logger resources to APIM",
38+
"credentials": {
39+
"instrumentationKey": "[reference(resourceId('Microsoft.Insights/components', parameters('ApplicationInsightsInstanceName')), '2015-05-01').InstrumentationKey]"
40+
}
41+
}
42+
},
43+
{
44+
"type": "Microsoft.ApiManagement/service/diagnostics",
45+
"name": "[concat(parameters('ApimServiceName'), '/applicationinsights')]",
46+
"apiVersion": "2018-06-01-preview",
47+
"properties": {
48+
"alwaysLog": "allErrors",
49+
"loggerId": "[concat('/loggers/', parameters('ApplicationInsightsInstanceName'))]",
50+
"sampling": {
51+
"samplingType": "fixed",
52+
"percentage": "[parameters('SamplingRate')]"
53+
},
54+
"frontend": {
55+
"request": {
56+
"headers": [],
57+
"body": {}
58+
},
59+
"response": {
60+
"headers": [],
61+
"body": {}
62+
}
63+
},
64+
"backend": {
65+
"request": {
66+
"headers": [],
67+
"body": {}
68+
},
69+
"response": {
70+
"headers": [],
71+
"body": {}
72+
}
73+
},
74+
"enableHttpCorrelationHeaders": false
75+
},
76+
"dependsOn": [
77+
"[resourceId('Microsoft.ApiManagement/service/loggers', parameters('ApimServiceName'), parameters('ApplicationInsightsInstanceName'))]"
78+
]
79+
}
80+
81+
]
82+
}

example/product-starter/product-starter.template.json renamed to example/products/product-starter.template.json

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
{
2-
"$schema":
3-
"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
43
"contentVersion": "1.0.0.0",
54
"parameters": {
65
"ApimServiceName": {
7-
"type": "string"
8-
},
9-
"repoBaseUrl":{
106
"type": "string",
117
"metadata": {
12-
"description": "Base URL of the repository"
8+
"description": "The name of the API Management"
139
}
1410
}
1511
},
1612
"variables": {},
1713
"resources": [
1814
{
1915
"type": "Microsoft.ApiManagement/service/products",
20-
"name":
21-
"[concat(parameters('ApimServiceName'), '/starter')]",
16+
"name": "[concat(parameters('ApimServiceName'), '/starter')]",
2217
"apiVersion": "2018-01-01",
2318
"scale": null,
2419
"properties": {
2520
"displayName": "Starter",
26-
"description":
27-
"Include 3 APIs. Limited to 1 subscription per developer. Throttled at 3 calls per 10 second.",
21+
"description": "Include 3 APIs. Limited to 1 subscription per developer. Throttled at 3 calls per 10 second.",
2822
"terms": null,
2923
"subscriptionRequired": true,
3024
"approvalRequired": true,
@@ -34,12 +28,11 @@
3428
},
3529
{
3630
"type": "Microsoft.ApiManagement/service/products/policies",
37-
"name":
38-
"[concat(parameters('ApimServiceName'), '/starter/policy')]",
31+
"name": "[concat(parameters('ApimServiceName'), '/starter/policy')]",
3932
"apiVersion": "2018-01-01",
4033
"properties": {
41-
"policyContent": "[concat(parameters('repoBaseUrl'), '/product-starter/product-starter.policy.xml')]",
42-
"contentFormat": "rawxml-link"
34+
"policyContent": "<policies><inbound><rate-limit calls=\"3\" renewal-period=\"10\" /><base /></inbound><outbound><base /></outbound><backend><base /></backend><on-error><base /></on-error></policies>",
35+
"contentFormat": "rawxml"
4336
},
4437
"dependsOn": [
4538
"[resourceId('Microsoft.ApiManagement/service/products', parameters('ApimServiceName'), 'starter')]"

example/product-starter/product-starter.policy.xml renamed to example/products/product-unlimited.policy.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<policies>
22
<inbound>
3-
<rate-limit calls="3" renewal-period="10" />
43
<base />
54
</inbound>
65
<outbound>
@@ -12,4 +11,4 @@
1211
<on-error>
1312
<base />
1413
</on-error>
15-
</policies>
14+
</policies>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"type": "string",
7+
"metadata": {
8+
"description": "The name of the API Management"
9+
}
10+
},
11+
"repoBaseUrl": {
12+
"type": "string",
13+
"metadata": {
14+
"description": "Base URL of the repository"
15+
}
16+
}
17+
},
18+
"variables": {},
19+
"resources": [
20+
{
21+
"type": "Microsoft.ApiManagement/service/products",
22+
"name": "[concat(parameters('ApimServiceName'), '/unlimited')]",
23+
"apiVersion": "2018-01-01",
24+
"scale": null,
25+
"properties": {
26+
"displayName": "Unlimited",
27+
"description": "Subscribers have completely unlimited access to the API. Administrator approval is required.",
28+
"terms": null,
29+
"subscriptionRequired": true,
30+
"approvalRequired": true,
31+
"subscriptionsLimit": 1,
32+
"state": "published"
33+
}
34+
},
35+
{
36+
"type": "Microsoft.ApiManagement/service/products/policies",
37+
"name": "[concat(parameters('ApimServiceName'), '/unlimited/policy')]",
38+
"apiVersion": "2018-01-01",
39+
"properties": {
40+
"policyContent": "[concat(parameters('repoBaseUrl'), '/products/product-unlimited.policy.xml')]",
41+
"contentFormat": "rawxml-link"
42+
},
43+
"dependsOn": [
44+
"[resourceId('Microsoft.ApiManagement/service/products', parameters('ApimServiceName'), 'unlimited')]"
45+
]
46+
},
47+
{
48+
"type": "Microsoft.ApiManagement/service/products/groups",
49+
"name": "[concat(parameters('ApimServiceName'), '/unlimited/contosogroup' )]",
50+
"apiVersion": "2017-03-01",
51+
"scale": null,
52+
"properties": {},
53+
"dependsOn": [
54+
"[resourceId('Microsoft.ApiManagement/service/products', parameters('ApimServiceName'), 'unlimited')]"
55+
]
56+
}
57+
],
58+
"outputs": {}
59+
}

0 commit comments

Comments
 (0)