Web Apps - krzysiek861/AvanadeWorkshop Wiki

Checkout branch

git checkout feature/web-app

This is a starter branch for the workshop.

Configure application settings

  1. Web.config (WebApp project)

Copy your KeyVault URI and paste it to the KeyVaultUri app setting.

  1. App.config (Topics project)

Do the same here.

Deployment

In the Visual Studio 2022 right click the WebApp project and select "Publish..." option. Follow the configuration wizard to generate your publish profile.

When the publish configuration is complete, the Publish button is available in the right top corner. Don't be shy and click it ;) Once the deployment is finished the browser tab should open with the app you just deployed.

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)

Run the app locally (requires "az login" command in Power Shell, leave console open) 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

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