- Introduction
- Slides
- Overview
- Context (Architecture Diagram)
- Reference to previous session
- Workshop
- Environment Configuration
- Deploy Functions & Apps
- Testing
- Power BI
- Wrap-up
- Azure Subscription - https://azure.microsoft.com/en-us/free/
- VS Code - https://code.visualstudio.com/Download (in case you prefer to use VS Code)
- Visual Studio 2019 - https://visualstudio.microsoft.com/vs/ (in case you prefer to use Visual Studio)
- Azure CLI - https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
- Azure Functions extension for Visual Studio Code - https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
- Azure Functions Core Tools - https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Ccsharp%2Cbash#v2
- PowerShell Core - https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.1
- Git - https://git-scm.com/downloads
- Fork the repository
- Clone locally
- Authenticate using
az login
- Get the details of the Azure subscription using
az account show
- Run
deploy.ps1
- The script will create the following:
- Azure Resource Group
- Azure SignalR service
- Azure Storage Account
- Azure CosmosDB with Database and Container
- Azure Function
- The script will create the following:
- Copy the generated connection strings at the bottom of the script
-
Paste the connection strings in the HotDogFunctions
local.settings.json
The values on the file should look similar to this:
"Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet", "CustomVisionEndpoint": "https://foodcustomvision.cognitiveservices.azure.com/", "CustomVisionPredictionKey": "74f181dc48934a81937d185908e5c3d4", "CustomVisionProjectId": "17d67036-31ed-4e1e-acc6-57e147af7ac0", "CustomVisionPublishedName": "HotDogsDetectionModel", "AzureSignalRConnectionString": "xxxxx", "AzureStorageConnectionString": "xxxxx", "CosmosDBConnection": "xxxxx", "PowerBIHotDogsApi": "https://api.powerbi.com/beta/12bec8d7-324b-410c-ab22-58f935feab3f/datasets/7d2cc9cb-17dc-4efb-bd89-8993bcefb728/rows?key=oqpiLYQrR61xdBdULUVxX0Qle4y7E94CW6wfcLgfm7pku97cz9TAteV6c7bj7hxktE63l1c0gqGlsW9uCkTgBQ%3D%3D" }
-
Start the Function App and check that it runs
-
Deploy the function using (Visual Studio 2019):
- In Visual Studio, right click the function app and click publish
- Go through the steps and select:
- Azure Function Windows
- Pick the previously created Azure Function
- Select Publish(generates pubxml file)
- Before publishing select Manage Azure App Service Settings
- Copy Connection Strings and Custom Vision setting to Remote
- Click Publish
-
Deploy the function using (VS Code):
- In VS Code go to the Azure Extension
- In the functions section expand your subscription to confirm the function app is created
- Make sure the terminal is in the function folder:
cd .\HotDogFunctions\
- Right click on the function app and click: Deploy
-
Once it's deployed copy the Function App URL
-
In the HotDogWebApp folder expand
wwwroot
-
Open
app.settings.json
and replace the HotDogApi setting with the Function App URLIt should look similar to this
{ "HotDogApi": "https://hotdognothotdog000.azurewebsites.net/api/" }
-
Start the Web App and check that it runs
-
Deploy the Web App using (Azure Portal):
- Create new Static Web App Preview resource
- Select Resource Group, Name and Region
- Authorize GitHub
- Select the festive-calendar-serverless repository
- Select Blazor as the build preset
- Change App Location to HotDogWebApp
- Create the website, this will create a
yaml
in your repository and use GitHub actions to trigger a deploy
-
Deploy the Web App using VS Code:
- Open Azure Extension
- Navigate to Static Web Apps (Preview) section
- Create a new Static Web App
- Right click on your subscription listed in the section
- Select Create Static Web App (Advanced) option
- Select Use existing Github repository option
- Select your organization
- Select the cloned repository
- Select master branch
- Provide a name for your Web App
- Select the resource group created previously
- Select Blazor as the project type
- Select the location
- Modify Workflow file from Github or modify workflow locally by running
git pull
and accessing the workflow file located in the.github\workflows
folder- Access your repository on Github
- Select menu option Actions
- Select the existing deployment
- Select the three ellipses option on the top right corner
- Select View workflow file option
- Select the pencil to edit the workflow file
- Modify the app_location parameter from
Client
toHotDogWebApp
- Navigate to the Azure Portal, locate your Static Web App, and browse the App
- Upload one or more images (with hotdogs or without hotdogs)
- Access the List option (on the left menu) to list the photos uploaded, and ensure your photo is showing up.