|
1 |
| -// param name string |
2 |
| - |
3 |
| -// @description('Resource name to uniquely identify this API within the API Management service instance') |
4 |
| -// @minLength(1) |
5 |
| -// param apiName string |
6 |
| - |
7 |
| -// @description('The Display Name of the API') |
8 |
| -// @minLength(1) |
9 |
| -// @maxLength(300) |
10 |
| -// param apiDisplayName string |
11 |
| - |
12 |
| -// @description('Description of the API. May include HTML formatting tags.') |
13 |
| -// @minLength(1) |
14 |
| -// param apiDescription string |
15 |
| - |
16 |
| -// @description('Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.') |
17 |
| -// @minLength(1) |
18 |
| -// param apiPath string |
19 |
| - |
20 |
| -// @description('Absolute URL of the web frontend') |
21 |
| -// param webFrontendUrl string |
22 |
| - |
23 |
| -// @description('Absolute URL of the backend service implementing this API.') |
24 |
| -// param apiBackendUrl string |
25 |
| - |
26 |
| -// @description('Resource name for backend Web App or Function App') |
27 |
| -// param apiAppName string = '' |
28 |
| - |
29 |
| -// var apiPolicyContent = replace(loadTextContent('./apim-api-policy.xml'), '{origin}', webFrontendUrl) |
30 |
| - |
31 |
| -// resource restApi 'Microsoft.ApiManagement/service/apis@2021-12-01-preview' = { |
32 |
| -// name: apiName |
33 |
| -// parent: apimService |
34 |
| -// properties: { |
35 |
| -// description: apiDescription |
36 |
| -// displayName: apiDisplayName |
37 |
| -// path: apiPath |
38 |
| -// protocols: [ 'https' ] |
39 |
| -// subscriptionRequired: false |
40 |
| -// type: 'http' |
41 |
| -// format: 'openapi' |
42 |
| -// serviceUrl: apiBackendUrl |
43 |
| -// value: loadTextContent('../../src/api/openapi.yaml') |
44 |
| -// } |
45 |
| -// } |
46 |
| - |
47 |
| -// resource apiPolicy 'Microsoft.ApiManagement/service/apis/policies@2021-12-01-preview' = { |
48 |
| -// name: 'policy' |
49 |
| -// parent: restApi |
50 |
| -// properties: { |
51 |
| -// format: 'rawxml' |
52 |
| -// value: apiPolicyContent |
53 |
| -// } |
54 |
| -// } |
55 |
| - |
56 |
| -// resource apiDiagnostics 'Microsoft.ApiManagement/service/apis/diagnostics@2021-12-01-preview' = { |
57 |
| -// name: 'applicationinsights' |
58 |
| -// parent: restApi |
59 |
| -// properties: { |
60 |
| -// alwaysLog: 'allErrors' |
61 |
| -// backend: { |
62 |
| -// request: { |
63 |
| -// body: { |
64 |
| -// bytes: 1024 |
65 |
| -// } |
66 |
| -// } |
67 |
| -// response: { |
68 |
| -// body: { |
69 |
| -// bytes: 1024 |
70 |
| -// } |
71 |
| -// } |
72 |
| -// } |
73 |
| -// frontend: { |
74 |
| -// request: { |
75 |
| -// body: { |
76 |
| -// bytes: 1024 |
77 |
| -// } |
78 |
| -// } |
79 |
| -// response: { |
80 |
| -// body: { |
81 |
| -// bytes: 1024 |
82 |
| -// } |
83 |
| -// } |
84 |
| -// } |
85 |
| -// httpCorrelationProtocol: 'W3C' |
86 |
| -// logClientIp: true |
87 |
| -// loggerId: apimLogger.id |
88 |
| -// metrics: true |
89 |
| -// sampling: { |
90 |
| -// percentage: 100 |
91 |
| -// samplingType: 'fixed' |
92 |
| -// } |
93 |
| -// verbosity: 'verbose' |
94 |
| -// } |
95 |
| -// } |
96 |
| - |
97 |
| -// resource apimService 'Microsoft.ApiManagement/service@2021-08-01' existing = { |
98 |
| -// name: name |
99 |
| -// } |
100 |
| - |
101 |
| -// // Necessary due to https://github.com/Azure/bicep/issues/9594 |
102 |
| -// // placeholderName is never deployed, it is merely used to make the child name validation pass |
103 |
| -// var appNameForBicep = !empty(apiAppName) ? apiAppName : 'placeholderName' |
104 |
| - |
105 |
| -// resource apiAppProperties 'Microsoft.Web/sites/config@2022-03-01' = if (!empty(apiAppName)) { |
106 |
| -// name: '${appNameForBicep}/web' |
107 |
| -// kind: 'string' |
108 |
| -// properties: { |
109 |
| -// apiManagementConfig: { |
110 |
| -// id: '${apimService.id}/apis/${apiName}' |
111 |
| -// } |
112 |
| -// } |
113 |
| -// } |
114 |
| - |
115 |
| -// resource apimLogger 'Microsoft.ApiManagement/service/loggers@2021-12-01-preview' existing = { |
116 |
| -// name: 'app-insights-logger' |
117 |
| -// parent: apimService |
118 |
| -// } |
119 |
| - |
120 |
| -// output SERVICE_API_URI string = '${apimService.properties.gatewayUrl}/${apiPath}' |
| 1 | +param name string |
| 2 | + |
| 3 | +@description('Resource name to uniquely identify this API within the API Management service instance') |
| 4 | +@minLength(1) |
| 5 | +param apiName string |
| 6 | + |
| 7 | +@description('The Display Name of the API') |
| 8 | +@minLength(1) |
| 9 | +@maxLength(300) |
| 10 | +param apiDisplayName string |
| 11 | + |
| 12 | +@description('Description of the API. May include HTML formatting tags.') |
| 13 | +@minLength(1) |
| 14 | +param apiDescription string |
| 15 | + |
| 16 | +@description('Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.') |
| 17 | +@minLength(1) |
| 18 | +param apiPath string |
| 19 | + |
| 20 | +@description('Absolute URL of the web frontend') |
| 21 | +param webFrontendUrl string |
| 22 | + |
| 23 | +@description('Absolute URL of the backend service implementing this API.') |
| 24 | +param apiBackendUrl string |
| 25 | + |
| 26 | +@description('Resource name for backend Web App or Function App') |
| 27 | +param apiAppName string = '' |
| 28 | + |
| 29 | +var apiPolicyContent = replace(loadTextContent('./apim-api-policy.xml'), '{origin}', webFrontendUrl) |
| 30 | + |
| 31 | +resource restApi 'Microsoft.ApiManagement/service/apis@2021-12-01-preview' = { |
| 32 | + name: apiName |
| 33 | + parent: apimService |
| 34 | + properties: { |
| 35 | + description: apiDescription |
| 36 | + displayName: apiDisplayName |
| 37 | + path: apiPath |
| 38 | + protocols: [ 'https' ] |
| 39 | + subscriptionRequired: false |
| 40 | + type: 'http' |
| 41 | + format: 'openapi' |
| 42 | + serviceUrl: apiBackendUrl |
| 43 | + value: loadTextContent('../../src/api/openapi.yaml') |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +resource apiPolicy 'Microsoft.ApiManagement/service/apis/policies@2021-12-01-preview' = { |
| 48 | + name: 'policy' |
| 49 | + parent: restApi |
| 50 | + properties: { |
| 51 | + format: 'rawxml' |
| 52 | + value: apiPolicyContent |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +resource apiDiagnostics 'Microsoft.ApiManagement/service/apis/diagnostics@2021-12-01-preview' = { |
| 57 | + name: 'applicationinsights' |
| 58 | + parent: restApi |
| 59 | + properties: { |
| 60 | + alwaysLog: 'allErrors' |
| 61 | + backend: { |
| 62 | + request: { |
| 63 | + body: { |
| 64 | + bytes: 1024 |
| 65 | + } |
| 66 | + } |
| 67 | + response: { |
| 68 | + body: { |
| 69 | + bytes: 1024 |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + frontend: { |
| 74 | + request: { |
| 75 | + body: { |
| 76 | + bytes: 1024 |
| 77 | + } |
| 78 | + } |
| 79 | + response: { |
| 80 | + body: { |
| 81 | + bytes: 1024 |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | + httpCorrelationProtocol: 'W3C' |
| 86 | + logClientIp: true |
| 87 | + loggerId: apimLogger.id |
| 88 | + metrics: true |
| 89 | + sampling: { |
| 90 | + percentage: 100 |
| 91 | + samplingType: 'fixed' |
| 92 | + } |
| 93 | + verbosity: 'verbose' |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | +resource apimService 'Microsoft.ApiManagement/service@2021-08-01' existing = { |
| 98 | + name: name |
| 99 | +} |
| 100 | + |
| 101 | +// Necessary due to https://github.com/Azure/bicep/issues/9594 |
| 102 | +// placeholderName is never deployed, it is merely used to make the child name validation pass |
| 103 | +var appNameForBicep = !empty(apiAppName) ? apiAppName : 'placeholderName' |
| 104 | + |
| 105 | +resource apiAppProperties 'Microsoft.Web/sites/config@2022-03-01' = if (!empty(apiAppName)) { |
| 106 | + name: '${appNameForBicep}/web' |
| 107 | + kind: 'string' |
| 108 | + properties: { |
| 109 | + apiManagementConfig: { |
| 110 | + id: '${apimService.id}/apis/${apiName}' |
| 111 | + } |
| 112 | + } |
| 113 | +} |
| 114 | + |
| 115 | +resource apimLogger 'Microsoft.ApiManagement/service/loggers@2021-12-01-preview' existing = { |
| 116 | + name: 'app-insights-logger' |
| 117 | + parent: apimService |
| 118 | +} |
| 119 | + |
| 120 | +output SERVICE_API_URI string = '${apimService.properties.gatewayUrl}/${apiPath}' |
0 commit comments