Web Apps - micklpl/avanade-azure-workshop GitHub Wiki

Available tags

web-app-deployment web-app-alerts web-app-scaling web-app-settings

Deployment

git checkout web-app-deployment

Click Get Publish Profile on App Service Overview tab. This will start yourAppName.PublishSettings file download.

In Visual Studio right click on ASP.NET MVC project and select Publish option. Choose Import or Import Profile in VS2017 option and select file. Click Publish in the last step.

You should be able to browse your application deployed on azurewebsites.net domain. In case of failure, turn off custom errors by adding <customErrors mode="Off"/> to <system.web> section.

Alerts

git checkout web-app-alerts

Open Web.config file and observe system.webServer section.

Open Alerts tab for Web App.

Add new alert for Web App (not for App Service Plan) where Data Out is greater than 5MB for the last 5 minutes.

Deploy your Web Application.

Try to open Music tab and watch the video.

Navigate back to alerts tab. Observe the results.

You should be able to see that the event has happened.

Scaling (optional)

git checkout web-app-scaling

Run the app locally and observe footer value.

Deploy your application and observe footer value.

Observe the footer

Open Application settings and switch Platform to 32-bit and turn off 'Always On` setting

Go to Scale up (App Service plan) tab and choose Dev/test: Shared infrastructure tier.

Refresh the website and observe footer value.

Open DevController.cs and then navigate to /Dev on your Azure deployment.

Go to Scale up (App Service plan) tab and choose Dev/test: B1 tier.

Go to Scale out (App Service plan) tab and increase the number of instances (using slider).

Go to Scale up (App Service plan) tab and choose Production S1 tier. Apply the change.

Go to Scale out (App Service plan) tab.

Add two autoscaling rules:

  1. Increase the number of VMs by 1 each time when memory usage exceeds 90% for at least one hour
  2. Set the number of instances to 6 for weekends and to 8 for evenings (20-24) during workdays

NOTE: use + Add a scale condition on the bottom for each rule

Working with App Settings

git checkout web-app-settings

Observe web.config appSettings section and _Layout.html file.

Deploy your application.

Open 'Application settings` tab.

Add new entry in Application settings section setting key to githubUrl and value to your github account homepage.

Save the settings and refresh the page.

You should be navigated to your github homepage when you click the link in page's footer

⚠️ **GitHub.com Fallback** ⚠️