This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock-http-api.bicep
143 lines (134 loc) · 3.41 KB
/
mock-http-api.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
@description('Specifies the storage account name to use, which is globally unique.')
@minLength(3)
param storageAccountName string
@description('Specifies the name of the function app, which is globally unique.')
@minLength(3)
param appName string = storageAccountName
@description('Location for all resources.')
param location string = resourceGroup().location
resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}
resource serverFarm 'Microsoft.Web/serverfarms@2022-09-01' = {
name: '${storageAccountName}Serverfarm'
location: location
sku: {
name: 'Y1'
tier: 'Dynamic'
}
properties: {
}
}
resource functionApp 'Microsoft.Web/sites@2022-09-01' = {
name: appName
location: location
kind: 'functionapp'
identity: {
type: 'SystemAssigned'
}
properties: {
serverFarmId: serverFarm.id
siteConfig: {
appSettings: [
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${storageAccount.listKeys().keys[0].value}'
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${storageAccount.listKeys().keys[0].value}'
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4'
}
{
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'node'
}
{
name: 'WEBSITE_NODE_DEFAULT_VERSION'
value: '~16'
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1'
}
{
name: 'STORAGE_ACCESS_KEY'
value: storageAccount.listKeys().keys[0].value
}
{
name: 'STORAGE_ACCOUNT_NAME'
value: storageAccountName
}
{
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
value: applicationInsights.properties.InstrumentationKey
}
]
use32BitWorkerProcess: false
cors: {
allowedOrigins: [
'*'
]
supportCredentials: false
}
http20Enabled: true
ftpsState: 'Disabled'
}
httpsOnly: true
}
}
resource applicationInsights 'microsoft.insights/components@2020-02-02' = {
name: '${storageAccountName}Insights'
location: location
kind: 'web'
properties: {
Application_Type: 'web'
Request_Source: 'rest'
}
}
resource table 'Microsoft.Storage/storageAccounts/tableServices@2022-09-01' = {
parent: storageAccount
name: 'default'
properties: {
cors: {
corsRules: [
{
allowedOrigins: [
'*'
]
allowedMethods: [
'PUT'
'GET'
'POST'
]
maxAgeInSeconds: 0
exposedHeaders: [
'*'
]
allowedHeaders: [
'*'
]
}
]
}
}
}
resource requestsTable 'Microsoft.Storage/storageAccounts/tableServices/tables@2022-09-01' = {
parent: table
name: 'Requests'
}
resource responsesTable 'Microsoft.Storage/storageAccounts/tableServices/tables@2022-09-01' = {
parent: table
name: 'Responses'
}