Skip to content

Latest commit

 

History

History
326 lines (181 loc) · 12 KB

File metadata and controls

326 lines (181 loc) · 12 KB

Module 5: Authoring Serverless Applications in Azure

Lab Answer Key: Deploying Serverless Workloads to Azure

Before we start

  1. Ensure that you are logged in to your Windows 10 Virtual Machine using the following credentials:

    • Username: Admin

    • Password: Pa55w.rd

  2. Observe the Taskbar located at the bottom of your Windows 10 desktop. The Taskbar contains the icons for the common applications we will use in the labs:

    Note: You can also find shortcuts to these applications on the Desktop and in the Start Menu.

Exercise 1: Create Web App

Task 1: Open the Azure Portal

  1. On the Taskbar, click the Microsoft Edge icon.

  2. In the open browser window, navigate to the Azure Portal (https://portal.azure.com).

  3. Enter the email address of your Microsoft account.

  4. Click the Next button.

  5. Enter the password for your Microsoft account.

  6. Click the Sign in button.

Task 2: Create App Service Plan

  1. At the top of the portal, click the Cloud Shell icon to open a new shell instance.

  2. In the Cloud Shell command prompt at the bottom of the portal, type in the following command and press Enter to create a new Resource Group:

    az group create --name MOD05APPS --location eastus
    
  3. Type in the following command and press Enter to create a new Resource Group:

    az group create --name MOD05FUNC --location eastus
    
  4. Type in the following command and press Enter to view a list of possible CLI commands for App Service:

    az appservice --help
    
  5. Type in the following command and press Enter to view a list of possible CLI commands for App Service Plans:

    az appservice plan --help
    
  6. Type in the following command and press Enter to view a list of possible CLI commands to create App Service Plans:

    az appservice plan create --help
    
  7. Type in the following command and press Enter to create a new App Service Plan:

    az appservice plan create --is-linux --name HostedServicePlan --resource-group MOD05APPS --location eastus --sku B2
    

Task 3: Create a Web App Instance

  1. Type in the following command and press Enter to view a list of possible CLI commands for Web Apps:

    az webapp --help
    
  2. Type in the following command and press Enter to view a list of possible CLI commands to create Web Apps:

    az webapp create --help
    
  3. Type in the following command and press Enter to view a list of possible runtimes for a linux-based az webApp Service instance:

    az webapp list-runtimes --linux
    
  4. Type in the following command and press Enter to create a new blank Web App using a unique name:

    az webapp create --name [Unique Name Here] --plan HostedServicePlan --resource-group MOD05APPS --runtime "DOTNETCORE|2.0"
    

    Make sure you replace the [Unique Name Here] placeholder with a globally unique name. For example, if your unique name is blankinterestingapp, your command will look like this:

    az webapp create --name blankinterestingapp --plan HostedServicePlan --resource-group MOD05APPS --runtime "DOTNETCORE|2.0"
    
  5. On the left side of the portal, click the Resource groups link.

  6. In the Resource groups blade, locate and select the MOD05APPS Resource Group link.

  7. In the MOD05APPS blade, select the Web App you most recently created.

  8. In the Web App blade, click the Browse button at the top of the blade.

  9. Observe the placeholder page provided by Azure App Service.

  10. Close the additional browser tab and return to the browser tab with the Azure Portal currently active.

Review: In this exercise, you created a Linux-based App Service Plan that contained a blank Web App.

Exercise 2: Deploy Web App Code

Task 1: Deploy Code with a Web App Extension using ARM and GitHub

  1. At the top of the portal, click the Cloud Shell icon to open a new shell instance.

  2. In the Cloud Shell command prompt at the bottom of the portal, type in the following command and press Enter to create a new blank Web App using a unique name:

    az webapp create --name [Unique Name Here] --plan HostedServicePlan --resource-group MOD05APPS --runtime "NODE|9.4"
    

    Make sure you replace the [Unique Name Here] placeholder with a globally unique name. For example, if your unique name is githubproject, your command will look like this:

    az webapp create --name githubproject --plan HostedServicePlan --resource-group MOD05APPS --runtime "NODE|9.4"
    
  3. On the left side of the portal, click the Create a resource link.

  4. At the top of the New blade, locate the Search the Marketplace field.

  5. Enter the text Template Deployment into the search field and press Enter.

  6. In the Everything search results blade, select the Template deployment result.

  7. In the Template deployment blade, click the Create button.

  8. In the Custom deployment blade, click the Build your own template in the editor link.

  9. In the Edit template blade, click the Load file link.

  10. In the Open file dialog that appears, navigate to the Allfiles (F):\Mod05\Labfiles\Starter folder.

  11. Select the github.json file.

  12. Click the Open button.

  13. Back in the Edit template blade, click the Save button to persist the template.

  14. Back in the Custom deployment blade, perform the following actions:

    a. Leave the Subscription field set to it's default value.

    a. In the Resource group section, select the Use existing option.

    a. In the Resource group section, locate the list and select the MOD05APPS option.

    a. In the Web App Name field, enter the unique name of the Web App you created earlier in this lab.

    a. In the Repository Url field, enter the value https://github.com/Azure-Samples/nodejs-docs-hello-world.

    a. Leave the Branch field set to it's default value.

    a. In the Terms and Conditions section, select the I agree to the terms and conditions stated above checkbox.

    a. Click the Purchase button.

  15. Wait for the deployment task to complete before moving on with this lab.

  16. On the left side of the portal, click the Resource groups link.

  17. In the Resource groups blade, locate and select the MOD05APPS Resource Group link.

  18. In the MOD05APPS blade, select the Web App you most recently created.

  19. In the Web App blade, click the Browse button at the top of the blade.

  20. Observe the sample Node.js web application deployed from GitHub.

Task 2: Deploy Code with a Docker Hub Container Image

  1. At the top of the portal, click the Cloud Shell icon to open a new shell instance.

  2. In the Cloud Shell command prompt at the bottom of the portal, type in the following command and press Enter to create a new Web App using a unique name and the ghost container image from Docker Hub:

    az webapp create --name [Unique Name Here] --plan HostedServicePlan --resource-group MOD05APPS --deployment-container-image ghost
    

    Make sure you replace the [Unique Name Here] placeholder with a globally unique name. For example, if your unique name is examplewondefulblog, your command will look like this:

    az webapp create --name examplewondefulblog --plan HostedServicePlan --resource-group MOD05APPS --deployment-container-image ghost
    
  3. Wait for the creation task to complete before moving on with this lab.

  4. On the left side of the portal, click the Resource groups link.

  5. In the Resource groups blade, locate and select the MOD05APPS Resource Group link.

  6. In the MOD05APPS blade, select the Web App you most recently created.

  7. In the Web App blade, click the Browse button at the top of the blade. If the application does not appear, restart the web app and try again.

  8. Observe the Blog application deployed from Docker Hub.

Review: In this exercise, you deployed code using both ARM and a Docker Hub container image to various App Service instances.

Exercise 3: Deploy Function App and Code

Task 1: Deploy Function App with Code using ARM

  1. At the top of the New blade, locate the Search the Marketplace field.

  2. Enter the text Template Deployment into the search field and press Enter.

  3. In the Everything search results blade, select the Template deployment result.

  4. In the Template deployment blade, click the Create button.

  5. In the Custom deployment blade, click the Build your own template in the editor link.

  6. In the Edit template blade, click the Quickstart Template link.

  7. In the Load a quickstart template dialog that appears, select the 201-function-app-dedicated-github-deploy template from the list of available templates.

  8. Click the OK button.

  9. Back in the Edit template blade, click the Save button to persist the template.

  10. Back in the Custom deployment blade, perform the following actions:

    a. Leave the Subscription field set to it's default value.

    a. In the Resource group section, select the Use existing option.

    a. In the Resource group section, locate the list and select the MOD05FUNC option.

    a. In the App Name field, enter a unique name for the new Function App.

    a. In the Sku list, select the Basic option.

    a. Leave the Worker Size field set to it's default value.

    a. Leave the Storage Account Type field set to it's default value.

    a. Leave the Repo URL field set to it's default value.

    a. Leave the Branch field set to it's default value.

    a. In the Terms and Conditions section, select the I agree to the terms and conditions stated above checkbox.

    a. Click the Purchase button.

  11. Wait for the creation task to complete before moving on with this lab.

  12. On the left side of the portal, click the Resource groups link.

  13. In the Resource groups blade, locate and select the MOD05FUNC Resource Group link.

  14. In the MOD05FUNC blade, select the Function App you most recently created.

  15. In the Function Apps blade, locate the Url field at the top of the blade and click the hyperlink below the field to see the Function App landing page in a new browser tab.

  16. Close the additional browser tab and return to the browser tab with the Azure Portal currently active.

Review: In this exercise, you deployed a Function App and code using an automated ARM template.

Exercise 4: Cleanup Subscription

Task 1: Open Cloud Shell

  1. At the top of the portal, click the Cloud Shell icon to open a new shell instance.

  2. In the Cloud Shell command prompt at the bottom of the portal, type in the following command and press Enter to list all resource groups in the subscription:

    az group list
    

Task 2: Delete Resource Groups

  1. Type in the following command and press Enter to delete the MOD05APPS Resource Group:

    az group delete --name MOD05APPS --no-wait --yes
    
  2. Type in the following command and press Enter to delete the MOD05FUNC Resource Group:

    az group delete --name MOD05FUNC --no-wait --yes
    
  3. Close the Cloud Shell prompt at the bottom of the portal.

Task 3: Close Active Applications

  1. Close the currently running Microsoft Edge application.

Review: In this exercise, you "cleaned up your subscription" by removing the Resource Groups used in this lab.