SlideShare a Scribd company logo
Deploying
your static
web app
Chris Noring, Senior Cloud
Developer Advocate
@Chris_Noring
Static app vs Web App
• No resolve
process, just
• HTML
• CSS
• JavaScript
@chris_noring
• Dynamic pages
• Resolve with call to backend
• Produces:
• HTML
• CSS
• JavaScript
• Static pages
Web AppStatic App
How do we create ?
• SPA frameworks like
• React
• Angular
• Vue
• Svelte
@chris_noring
Web app
• Static site generators like
• VuePress
• Gatsby
• Scully
Static app
The jamstack
It’s not about technologies but - Prerendering files, serve from
CDN
WHY & WHAT YOU GET
- better performance,
- higher security,
- lower cost of scaling,
- better developer experience
YOU CAN ENHANCE THEM
- Pre-rendered sites can be enhanced with JavaScript
and the growing capabilities of browsers and services
available via APIs
https://jamstack.org/
@chris_noring
Traditional apps vs JamStack
Frontend
Backend
DB
Page load when:
1. Page talks to backend
2. Backend talks to DB
3. Rendering
Static
app
API
API
Frontend
Pre rendering
DB
YAML
JSON Markup
JAMSTACK
1.
2.
@chris_noring
Static
app
Static
appCDN
Deploying a Jamstack
• The parts
• The static app
• The API ?
• Things to consider
• Fallback routes
• Auth?
• Prep to deploy (build step/s)
@chris_noring
Azure Static Web Apps service
• Web hosting for static content like HTML, CSS, JavaScript, and images.
• Integrated API support provided by Azure Functions.
• First-party GitHub integration where repository changes trigger builds and deployments.
• Globally distributed static content, putting content closer to your users.
• Free SSL certificates, which are automatically renewed.
• Custom domains* to provide branded customizations to your app.
• Seamless security model with a reverse-proxy when calling APIs, which requires no CORS configuration.
• Authentication provider integrations with Azure Active Directory, Facebook, Google, GitHub, and Twitter.
• Customizable authorization role definition and assignments.
• Back-end routing rules enabling full control over the content and routes you serve.
• Generated staging versions powered by pull requests enabling preview versions of your site before publishing.
@chris_noring
DEMO - deploy
Use Static web apps service, review the resource
@chris_noring
Workflow file
@chris_noring
DEMO – add API
Auth,
inivitation
• Generate
• Select provider
• Add username or email address
• Select domain (the custom domain)
• Add roles, admin, user etc (comma
separated)
• Enter invitation validity in hours
• Generate a link
• Invite
• Send generated link
• Login
• Recipient is prompted to login with their login
of chosen provider type
@chris_noring
Deploying your static web app to the Cloud
Auth, how to implement
<a href="/.auth/login/github">Login</a>
“routes”: [{
"route": "/login",
"serve": "/.auth/login/github"
}]
routes.json
Send user to login page
<a href="/.auth/logout">Log out</a> Have user logout with a link like this
post_login_redirect_uri= <send user here>
Set this query parameter if you want to send user
To a specific route after login
Auth, get logged-in info
async function getUserInfo() {
const response = await fetch("/.auth/me");
const payload = await response.json();
const { clientPrincipal } = payload;
return clientPrincipal;
}
console.log(getUserInfo());
{
"identityProvider": "facebook",
"userId": "d75b260a64504067bfc5b2905e3b8182",
"userDetails": "user@example.com",
"userRoles": [ "anonymous", "authenticated" ]
}
Auth, logged-in info, from API
module.exports = async function (context, req) {
const header = req.headers["x-ms-client-principal"];
const encoded = Buffer.from(header, "base64");
const decoded = encoded.toString("ascii");
context.res = {
body: {
clientPrincipal: JSON.parse(decoded)
}
};
};
Restict access based on role and route
{
"route": "/profile",
"allowedRoles": ["authenticated"]
}
{
"routes": [ {
"route": "/profile",
"allowedRoles": ["authenticated"]
}, {
"route": "/admin/*",
"allowedRoles": ["administrator"]
}, {
"route": "/api/admin",
"allowedRoles": ["administrator"]
}, {
"route": "/customers/contoso",
"allowedRoles": ["administrator", "customers_contoso"]
}, {
"route": "/login",
"serve": "/.auth/login/github"
}, {
"route": "/.auth/login/twitter",
"statusCode": "404"
}, {
"route": "/logout",
"serve": "/.auth/logout"
}, {
"route": "/calendar/*",
"serve": "/calendar.html"
}]
Summary
• Static apps, just HTML, CSS, JS, secure, small and fast to load
• Web Apps, has backend, resolves when it’s requested, can never
be as fast as above
• Static Web Apps,
• can help you deploy both types of app
• Supports Azure Function as API
• Supports Auth with AAD, Azure Active Directory and social logins like
Twitter, Facebook, GitHub et al
@chris_noring
Learn more
• Aka.ms/swadocs , Overview page
• Getting blazor to work on Static Web Apps
https://timheuer.com/blog/category/blazor
• LEARN module, Gatsby + SWA, https://docs.microsoft.com/en-
us/learn/modules/create-deploy-static-webapp-gatsby-app-service/
• LEARN module, SPA deploy (Angular, React, Vue, Svelte),
https://docs.microsoft.com/en-us/learn/modules/publish-app-service-static-
web-app-api
• Securing your app, https://docs.microsoft.com/en-gb/azure/static-web-
apps/authentication-authorization AAD + Social login
@chris_noring

More Related Content

PPTX
Get Some Rest - Taking Advantage of the SharePoint 2013 REST API
PPTX
[Vončina] Configuring SharePoint 2016 for BI Scenarios
PDF
Developing an intranet on office 365
PPTX
ECS 2018: Introduction to Azure Web Applications
PPTX
Azure staticwebapps
PPTX
Introduction to Office and SharePoint Development
PDF
SharePoint 2013 - A Real World Help Desk App End to End
PDF
O365Con18 - Introduction to Azure Web Applications - Eric Shupps
Get Some Rest - Taking Advantage of the SharePoint 2013 REST API
[Vončina] Configuring SharePoint 2016 for BI Scenarios
Developing an intranet on office 365
ECS 2018: Introduction to Azure Web Applications
Azure staticwebapps
Introduction to Office and SharePoint Development
SharePoint 2013 - A Real World Help Desk App End to End
O365Con18 - Introduction to Azure Web Applications - Eric Shupps

What's hot (20)

PPTX
Introduction to the SharePoint Client Object Model and REST API
PPTX
SharePoint and Office Development Workshop
PDF
SPUnite17 Who Are You and What Do You Want
PDF
Rest Security with JAX-RS
PDF
SPTECHCON - Get Some REST - Taking Advantage of the SharePoint 2013 REST API
PPTX
Building API in the cloud using Azure Functions
PPTX
Building SharePoint Single Page Applications Using AngularJS
PPTX
[Roine] Serverless: Don't Take It Literally
PDF
SPTECHCON - Rev Your Engines - SharePoint 2013 Performance Enhancements
PDF
Share point 2010 performance and capacity planning best practices
PDF
Spsdc 2014 o365_power_shell_csom_amitv
PDF
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
PPTX
SharePoint 2013 Javascript Object Model
PPTX
Web API 2 Token Based Authentication
PDF
Firebase hosting
PPTX
Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESP...
PPTX
Share point hosted add ins munich
PPTX
Cloud Dev with Azure Functions - DogFoodCon 2018 - Brian T Jackett
PDF
Spsct15 power shell_csom - amit vasu
PDF
Office 365 Directory Synchronization
Introduction to the SharePoint Client Object Model and REST API
SharePoint and Office Development Workshop
SPUnite17 Who Are You and What Do You Want
Rest Security with JAX-RS
SPTECHCON - Get Some REST - Taking Advantage of the SharePoint 2013 REST API
Building API in the cloud using Azure Functions
Building SharePoint Single Page Applications Using AngularJS
[Roine] Serverless: Don't Take It Literally
SPTECHCON - Rev Your Engines - SharePoint 2013 Performance Enhancements
Share point 2010 performance and capacity planning best practices
Spsdc 2014 o365_power_shell_csom_amitv
O365Con18 - Connect SharePoint Framework Solutions to API's secured with Azur...
SharePoint 2013 Javascript Object Model
Web API 2 Token Based Authentication
Firebase hosting
Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESP...
Share point hosted add ins munich
Cloud Dev with Azure Functions - DogFoodCon 2018 - Brian T Jackett
Spsct15 power shell_csom - amit vasu
Office 365 Directory Synchronization
Ad

Similar to Deploying your static web app to the Cloud (20)

PPTX
Building Progressive Web Apps for Windows devices
PDF
Performance and Scalability Art of Isomorphic React Applications
PPTX
Introduction aux progressive web apps
PDF
Progressive Web Apps are here!
PDF
20181023 progressive web_apps_are_here_sfcampua
PPTX
Azure Static Web Apps
PPTX
slides.pptx
PDF
Made for Mobile - Let Office 365 Power Your Mobile Apps
PPTX
Developing Apps with Azure AD
PDF
Node.js BFFs - our way to the better/micro frontends
PDF
A year with progressive web apps! #DevConMU
PDF
Firefox OS Weekend
PDF
Lessons Learned from Using Next.js in Production
PDF
Client-side Auth with Ember.js
PPTX
Academy PRO: ASP .NET Core
PDF
Shields Up! Securing React Apps
PPTX
Introduction to OAuth2
PPTX
Build Modern Web Apps Using ASP.NET Web API and AngularJS
PDF
MongoDB.local Berlin: App development in a Serverless World
PDF
Pwa, separating the features from the solutions
Building Progressive Web Apps for Windows devices
Performance and Scalability Art of Isomorphic React Applications
Introduction aux progressive web apps
Progressive Web Apps are here!
20181023 progressive web_apps_are_here_sfcampua
Azure Static Web Apps
slides.pptx
Made for Mobile - Let Office 365 Power Your Mobile Apps
Developing Apps with Azure AD
Node.js BFFs - our way to the better/micro frontends
A year with progressive web apps! #DevConMU
Firefox OS Weekend
Lessons Learned from Using Next.js in Production
Client-side Auth with Ember.js
Academy PRO: ASP .NET Core
Shields Up! Securing React Apps
Introduction to OAuth2
Build Modern Web Apps Using ASP.NET Web API and AngularJS
MongoDB.local Berlin: App development in a Serverless World
Pwa, separating the features from the solutions
Ad

More from Christoffer Noring (20)

PPTX
Azure signalR
PPTX
Game dev 101 part 3
PPTX
Game dev 101 part 2
PPTX
Game dev workshop
PPTX
IaaS with ARM templates for Azure
PPTX
Learning Svelte
PPTX
PDF
Angular Schematics
PDF
Design thinking
PDF
Keynote ijs
PDF
Vue fundamentasl with Testing and Vuex
PDF
Ngrx slides
PDF
PPTX
Angular mix chrisnoring
PDF
Nativescript angular
PDF
Graphql, REST and Apollo
PDF
Angular 2 introduction
PDF
Rxjs vienna
PPTX
Rxjs marble-testing
PDF
React lecture
Azure signalR
Game dev 101 part 3
Game dev 101 part 2
Game dev workshop
IaaS with ARM templates for Azure
Learning Svelte
Angular Schematics
Design thinking
Keynote ijs
Vue fundamentasl with Testing and Vuex
Ngrx slides
Angular mix chrisnoring
Nativescript angular
Graphql, REST and Apollo
Angular 2 introduction
Rxjs vienna
Rxjs marble-testing
React lecture

Recently uploaded (20)

PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Transform Your Business with a Software ERP System
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
L1 - Introduction to python Backend.pptx
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Cost to Outsource Software Development in 2025
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
history of c programming in notes for students .pptx
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How to Choose the Right IT Partner for Your Business in Malaysia
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Transform Your Business with a Software ERP System
Odoo Companies in India – Driving Business Transformation.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Why Generative AI is the Future of Content, Code & Creativity?
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Reimagine Home Health with the Power of Agentic AI​
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
L1 - Introduction to python Backend.pptx
Designing Intelligence for the Shop Floor.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Cost to Outsource Software Development in 2025
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
history of c programming in notes for students .pptx
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...

Deploying your static web app to the Cloud

  • 1. Deploying your static web app Chris Noring, Senior Cloud Developer Advocate @Chris_Noring
  • 2. Static app vs Web App • No resolve process, just • HTML • CSS • JavaScript @chris_noring • Dynamic pages • Resolve with call to backend • Produces: • HTML • CSS • JavaScript • Static pages Web AppStatic App
  • 3. How do we create ? • SPA frameworks like • React • Angular • Vue • Svelte @chris_noring Web app • Static site generators like • VuePress • Gatsby • Scully Static app
  • 4. The jamstack It’s not about technologies but - Prerendering files, serve from CDN WHY & WHAT YOU GET - better performance, - higher security, - lower cost of scaling, - better developer experience YOU CAN ENHANCE THEM - Pre-rendered sites can be enhanced with JavaScript and the growing capabilities of browsers and services available via APIs https://jamstack.org/ @chris_noring
  • 5. Traditional apps vs JamStack Frontend Backend DB Page load when: 1. Page talks to backend 2. Backend talks to DB 3. Rendering Static app API API Frontend Pre rendering DB YAML JSON Markup JAMSTACK 1. 2. @chris_noring Static app Static appCDN
  • 6. Deploying a Jamstack • The parts • The static app • The API ? • Things to consider • Fallback routes • Auth? • Prep to deploy (build step/s) @chris_noring
  • 7. Azure Static Web Apps service • Web hosting for static content like HTML, CSS, JavaScript, and images. • Integrated API support provided by Azure Functions. • First-party GitHub integration where repository changes trigger builds and deployments. • Globally distributed static content, putting content closer to your users. • Free SSL certificates, which are automatically renewed. • Custom domains* to provide branded customizations to your app. • Seamless security model with a reverse-proxy when calling APIs, which requires no CORS configuration. • Authentication provider integrations with Azure Active Directory, Facebook, Google, GitHub, and Twitter. • Customizable authorization role definition and assignments. • Back-end routing rules enabling full control over the content and routes you serve. • Generated staging versions powered by pull requests enabling preview versions of your site before publishing. @chris_noring
  • 9. Use Static web apps service, review the resource @chris_noring
  • 12. Auth, inivitation • Generate • Select provider • Add username or email address • Select domain (the custom domain) • Add roles, admin, user etc (comma separated) • Enter invitation validity in hours • Generate a link • Invite • Send generated link • Login • Recipient is prompted to login with their login of chosen provider type @chris_noring
  • 14. Auth, how to implement <a href="/.auth/login/github">Login</a> “routes”: [{ "route": "/login", "serve": "/.auth/login/github" }] routes.json Send user to login page <a href="/.auth/logout">Log out</a> Have user logout with a link like this post_login_redirect_uri= <send user here> Set this query parameter if you want to send user To a specific route after login
  • 15. Auth, get logged-in info async function getUserInfo() { const response = await fetch("/.auth/me"); const payload = await response.json(); const { clientPrincipal } = payload; return clientPrincipal; } console.log(getUserInfo()); { "identityProvider": "facebook", "userId": "d75b260a64504067bfc5b2905e3b8182", "userDetails": "[email protected]", "userRoles": [ "anonymous", "authenticated" ] }
  • 16. Auth, logged-in info, from API module.exports = async function (context, req) { const header = req.headers["x-ms-client-principal"]; const encoded = Buffer.from(header, "base64"); const decoded = encoded.toString("ascii"); context.res = { body: { clientPrincipal: JSON.parse(decoded) } }; };
  • 17. Restict access based on role and route { "route": "/profile", "allowedRoles": ["authenticated"] } { "routes": [ { "route": "/profile", "allowedRoles": ["authenticated"] }, { "route": "/admin/*", "allowedRoles": ["administrator"] }, { "route": "/api/admin", "allowedRoles": ["administrator"] }, { "route": "/customers/contoso", "allowedRoles": ["administrator", "customers_contoso"] }, { "route": "/login", "serve": "/.auth/login/github" }, { "route": "/.auth/login/twitter", "statusCode": "404" }, { "route": "/logout", "serve": "/.auth/logout" }, { "route": "/calendar/*", "serve": "/calendar.html" }]
  • 18. Summary • Static apps, just HTML, CSS, JS, secure, small and fast to load • Web Apps, has backend, resolves when it’s requested, can never be as fast as above • Static Web Apps, • can help you deploy both types of app • Supports Azure Function as API • Supports Auth with AAD, Azure Active Directory and social logins like Twitter, Facebook, GitHub et al @chris_noring
  • 19. Learn more • Aka.ms/swadocs , Overview page • Getting blazor to work on Static Web Apps https://timheuer.com/blog/category/blazor • LEARN module, Gatsby + SWA, https://docs.microsoft.com/en- us/learn/modules/create-deploy-static-webapp-gatsby-app-service/ • LEARN module, SPA deploy (Angular, React, Vue, Svelte), https://docs.microsoft.com/en-us/learn/modules/publish-app-service-static- web-app-api • Securing your app, https://docs.microsoft.com/en-gb/azure/static-web- apps/authentication-authorization AAD + Social login @chris_noring

Editor's Notes

  • #3: We have static pages in both cases but Web App is a more complicated thing with A resolve process A backend
  • #4: Static app, can also use a Backend, like an API, but at build time, not resolved Just in Time The idea is to talk to APIs and via static content, render HTML pages that don’t change
  • #5: Fast and secure sites and apps delivered by pre-rendering files and serving them directly from a CDN, removing the requirement to manage or run web servers. WHAT YOU GET better performance, - pre rendered higher security, - there’s no backend lower cost of scaling, - using CDN better developer experience YOU CAN ENHANCE THEM Pre-rendered sites can be enhanced with JavaScript and the growing capabilities of browsers and services available via APIs
  • #6: What does this look like in practice? The traditional Web App serves pages by Talking to a backend Fetch data Render a finished page The JamStack, creates everything at build time It also scales by placing copies of the static pages on various Servers, part of a CDN, Content delivery network to ensure scaling.
  • #7: The static app Deploying JamStack is easy, it’s just static files, you an deploy them anywhere like: GitHub A Web hotel Cloud storage like Blob storage The API If the API is a separate thing then you don’t need to worry, but IF the API is something that goes with the site then you need to consider how: Serverless, App Service Routing SPA apps needs to think about fallback routes, because of how the routing work Auth Auth, we might all kinds of solutions here like Identity Server or some kind of OAuth like JWT based
  • #8: Azure static web app service enables us to easy deploy our web apps and static apps to the Cloud in minutes. 1. Deploy static sites like Gatsby Hugo, VuePress 2. Deploy web apps built with Next, Nuxt, 3. Build and deploy Modern JavaScript Apps built with Angular, React, Vue, Svelte
  • #9: The idea here is to show how we can take a React application and easily deploy it Go to portal, enter static web apps Project details, fill in Subscription Resource group Static Web App details Name Region SKU Sign in with GitHub Enter source control details Organization Repository Branch Click Next > Build Build App location, where’s the app root or subfolder API location, usually API App artifact location, what directory does it build to <app location>/build for example Review & Create, select Create Go to resource
  • #10: Remember that Azure portal page? URL is where we find our app Workflow file, this is the YAML file that contains instructions for how to build and deploy your app Let’s take a closer look on the Workflow file
  • #11: This workflow file was added to our repo, with it we can When it’s triggered, Change when it’s triggered Change our selections, Change things like app_location, api_location, app_artifact_location We can do all sorts of adjustment it’s our YAML build file. E.g make it work for Blazor for example.
  • #12: Build an API Create a function app Configure local.dev.settings + Cors React App Configure proxy Call API locally Deploy Just add changes to Git Push code Go to GitHub View page
  • #13: Settings > Role Management > Invite
  • #15: Here’s how you can set things up in your app Login link Add entry in routes.json so we know what provider is being used Logout link Redirect param on login link, to ensure they end where you want
  • #16: How do we know if user is logged in? We check, via this API call, /.auth/me We can also check user roles that way
  • #17: If you are in the API and wants to know who the user is, what authorization they have
  • #18: Specify the route and the role/s it should allow for On the right, a more real example of how an app should be configured authenticated, built-in administrator 404 login, logout routes