The purpose of this template is to deploy the complete Contoso Expenses aplication to Azure. The following resources will be deployed.
- 2 Web Applications (Web and API)
- 1 Function App
- 2 Storage Accounts
- 1 SQL Database
- 1 SendGrid Email
This template uses GitHub integration to deploy to the Azure WebApps and Azure Function. It will also restore the database using a .bacpac file.
Folder pre-reqs contains a PowerShell script that you need to run in order to copy the database to a storage account in your subcription.
Run the script and make sure to copy the output somewhere since it will be used in the template deployment phase.
C:\..\ContosoExpensesARM\pre-reqs> .\Create-Storage-Account-And-Copy-DB.ps1
Successfully Signed-in
Created resource group
Created storage account
Created storage container
Successfully uploaded .bacpac to storage account
---- OUTPUT
- RESOURCE GROUP NAME: ContosoExpensesARM12345671
- STORAGE ACCOUNT NAME: sqlimport4516281
- STORAGE ACCOUNT KEY: sZ+1FFaHRvoHJYsSlvv1T3F3OIetCPWY8LiGLM0hjmwfJWPke5LHz5d2vHc5Q9EOPRmeXp+4AADVAUq5UG7HKkWA==
- KEEP THIS INFORMATION AS IT WILL BE REQUIRED FOR DEPLOYING -
To deploy the ARM template click the Deploy to Azure button. Fill in the required fields.
Make sure the information copied previously is used in the this deployment phase.
After deploying the template successfuly the SendGrid resource is already deployed in Azure but we need to generate an API Key and add it to the Azure Function Settings.
- Go to the Azure Portal and navigate to your SendGrid resource.
- Go to Configurations and copy the username that was automatically created.
- Go to http://app.sendgrid.com/ and log in using the username copied just now and the password created during the template deployment step.
- Expand the Settings tab on the left menu and click API Keys.
- Click Create API Key.
- Fill in the name of the key and select Full Access for the type of key.
- Copy the API Key that was generated by SendGrid.
Make sure you save the API Key somewhere as this is the only time you will be able to see it.
-
Go to the Azure Portal once again and navigate to your Azure Function.
-
Open your Azure Function and click Application Settings.
- Update the SendGridApiKey with the value you copied from the SendGrid portal and Save
That's it, you are ready to start!