forked from JeremyLikness/serverless-url-shortener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazuredeploy.json
156 lines (156 loc) · 5.77 KB
/
azuredeploy.json
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
144
145
146
147
148
149
150
151
152
153
154
155
156
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"siteName": {
"type": "string",
"metadata": {
"description": "The name of the function app that you wish to create."
}
},
"fallbackUrl": {
"type": "string",
"defaultValue": "https://blog.jeremylikness.com/?utm_source=jelikness&utm_medium=github&utm_campaign=url_shortener",
"metadata": {
"description": "The URL to fallback to if the short URL is invalid or not found"
}
},
"utmSource": {
"type": "string",
"defaultValue": "jeliknes",
"metadata": {
"description": "UTM_SOURCE for appending to end of URL for tracking"
}
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_RAGRS",
"Standard_L"
],
"metadata": {
"description": "Storage Account type"
}
},
"sourceCodeRepositoryURL": {
"type": "string",
"defaultValue": "https://github.com/JeremyLikness/serverless-url-shortener",
"metadata": {
"description": "Source code repository URL"
}
},
"sourceCodeBranch": {
"type": "string",
"defaultValue": "master",
"metadata": {
"description": "Sourcecode Repo branch"
}
}
},
"variables": {
"shortenerUrl": "[concat(parameters('siteName'), '.azurewebsites.net/')]",
"hostingPlanName": "[concat(parameters('siteName'), '-plan')]",
"storageAccountName": "[concat('azfnstore',uniquestring(resourceGroup().id))]",
"storageAccountid": "[concat(resourceGroup().id,'/providers/','Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
},
"resources": [
{
"type": "microsoft.insights/components",
"apiVersion": "2015-05-01",
"name": "[parameters('siteName')]",
"location": "South Central US",
"tags": {
"[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('siteName'))]": "Resource"
},
"properties": {
"ApplicationId": "[parameters('siteName')]",
"Request_Source": "IbizaWebAppExtensionCreate"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "2016-01-01",
"location": "[resourceGroup().location]",
"kind": "Storage",
"sku": {
"name": "[parameters('storageAccountType')]"
}
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2016-09-01",
"name": "[variables('hostingPlanName')]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Y1",
"tier": "Dynamic",
"size": "Y1",
"family": "Y",
"capacity": 0
},
"properties": {
"name": "[variables('hostingPlanName')]",
"computeMode": "Dynamic"
}
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2016-08-01",
"name": "[parameters('siteName')]",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"properties": {
"name": "[parameters('siteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"clientAffinityEnabled": false
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"[resourceId('microsoft.insights/components/', parameters('siteName'))]"
],
"resources": [
{
"type": "config",
"name": "appsettings",
"apiVersion": "2015-08-01",
"properties": {
"Project": "functionApp",
"AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]",
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]",
"WEBSITE_CONTENTSHARE": "[toLower(parameters('siteName'))]",
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('microsoft.insights/components/', parameters('siteName')), '2015-05-01').InstrumentationKey]",
"SHORTENER_URL": "[toLower(variables('shortenerUrl'))]",
"UTM_SOURCE": "[toLower(parameters('utmSource'))]",
"FALLBACK_URL": "[toLower(parameters('fallbackUrl'))]",
"FUNCTIONS_EXTENSION_VERSION": "~1",
"WEBSITE_NODE_DEFAULT_VERSION": "6.5.0",
"ROUTING_EXTENSION_VERSION": "~0.2"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
]
},
{
"type": "sourcecontrols",
"apiVersion": "2015-08-01",
"name": "web",
"properties": {
"RepoUrl": "[parameters('sourceCodeRepositoryURL')]",
"branch": "[parameters('sourceCodeBranch')]",
"IsManualIntegration": "true"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', parameters('siteName'))]",
"[resourceId('Microsoft.Web/Sites/config', parameters('siteName'), 'appsettings')]"
]
}
]
}
]
}