Skip to content

Commit 59b9d14

Browse files
committed
Add Sendgrid email backend to Azure deployment
1 parent ef8a77f commit 59b9d14

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

azuredeploy.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"adminPassword": {
3434
"type": "securestring",
3535
"minLength": 16,
36+
"maxLength": 50,
3637
"metadata": {
3738
"description": "The password for the admin account."
3839
}
@@ -52,6 +53,21 @@
5253
"description": "The SKU of the webapp hosting tier."
5354
}
5455
},
56+
"sendgridSku": {
57+
"type": "string",
58+
"defaultValue": "free",
59+
"allowedValues": [
60+
"free",
61+
"bronze",
62+
"silver",
63+
"gold",
64+
"platinum",
65+
"premier"
66+
],
67+
"metadata": {
68+
"description": "The SKU of the Sendgrid email account."
69+
}
70+
},
5571
"databaseCores": {
5672
"type": "int",
5773
"defaultValue": 2,
@@ -124,11 +140,29 @@
124140
"databaseUserCredentials" : "[concat(uriComponent(concat(parameters('adminUserName'), '@', variables('databaseServerName'))), ':', parameters('adminPassword'))]",
125141
"databaseFqdn" : "[concat( variables('databaseServerName'), '.postgres.database.azure.com:', variables('databaseServerPort'))]",
126142
"databaseConnectionString": "[concat('pgsql://', variables('databaseUserCredentials'), '@', variables('databaseFqdn'), '/', parameters('databaseName'))]",
143+
"sendgridAccountName": "[concat(parameters('appName'),'-email')]",
127144
"appServicePlanName": "[concat(parameters('appName'),'-hosting')]",
128145
"analyticsName": "[concat(parameters('appName'),'-analytics')]",
129146
"appFqdn": "[concat(parameters('appName'),'.azurewebsites.net')]"
130147
},
131148
"resources": [
149+
{
150+
"name": "[variables('sendgridAccountName')]",
151+
"type": "Sendgrid.Email/accounts",
152+
"apiVersion": "2015-01-01",
153+
"location": "[variables('location')]",
154+
"plan": {
155+
"name": "[parameters('sendgridSku')]",
156+
"publisher": "Sendgrid",
157+
"product": "sendgrid_azure",
158+
"promotionCode": ""
159+
},
160+
"properties": {
161+
"acceptMarketingEmails": false,
162+
"email": "[parameters('adminContactEmail')]",
163+
"password": "[parameters('adminPassword')]"
164+
}
165+
},
132166
{
133167
"type": "Microsoft.Insights/components",
134168
"apiVersion": "2015-05-01",
@@ -207,6 +241,7 @@
207241
"kind": "app,linux,container",
208242
"location": "[variables('location')]",
209243
"dependsOn": [
244+
"[resourceId('Sendgrid.Email/accounts', variables('sendgridAccountName'))]",
210245
"[resourceId('Microsoft.DBforPostgreSQL/servers/', variables('databaseServerName'))]",
211246
"[resourceId('Microsoft.Insights/components', variables('analyticsName'))]",
212247
"[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]"
@@ -261,6 +296,26 @@
261296
"name": "ADMIN_PASSWORD",
262297
"value": "[parameters('adminPassword')]"
263298
},
299+
{
300+
"name": "EMAIL_USE_TLS",
301+
"value": "True"
302+
},
303+
{
304+
"name": "EMAIL_HOST",
305+
"value": "[reference(resourceId('Sendgrid.Email/accounts', variables('sendgridAccountName'))).smtpServer]"
306+
},
307+
{
308+
"name": "EMAIL_HOST_USER",
309+
"value": "[reference(resourceId('Sendgrid.Email/accounts', variables('sendgridAccountName'))).username]"
310+
},
311+
{
312+
"name": "EMAIL_HOST_PASSWORD",
313+
"value": "[parameters('adminPassword')]"
314+
},
315+
{
316+
"name": "EMAIL_PORT",
317+
"value": "587"
318+
},
264319
{
265320
"name": "DEBUG",
266321
"value": "False"

0 commit comments

Comments
 (0)