🔏
Azure Serverless Quickstart
  • Introduction
  • Initial Setup
    • Workstation Installs
    • Codebase
      • Directory Structure
      • User Interface Project
        • Configuring StoryBook
        • Configure Tailwind
        • Configure Craco
        • -Architectural Decision Log
      • Data Access Project
        • DDD
      • Untitled
      • Full Stack Debugging
      • Creating GitHub Project
    • Infrastructure
      • Configure Session Behavior
      • Create AAD Tenant
      • Resource Group
      • Create AAD B2C Instance
        • Identity Experience Framework
        • Configure Session Behavior
      • Storage Account & CDN
        • CDN Rules
        • Configure Azure BLOB Storage
      • App Insights
        • Create AppInsight Account
        • Apollo GraphQL App Insights Configuration
      • CosmosDB
      • Twilio SendGrid
      • KeyVault
      • Function
      • Function App Settings
      • Front Door
      • DevOps
      • Optional Items
        • Azure Data Factory
      • Azure Event Hub
    • CICD and Source Control
      • Azure DevOps
      • SonarCloud
        • Incorporate into Yaml
      • Chromatic
      • User Interface YAML
      • CICD for Data Access
        • Create Pipeline
        • Data Access YAML
  • Application Structure
    • Connect Apollo
      • Apollo Overview
      • Create Apollo Component
    • MongoDB Integration
      • Mappings
      • Directory Structure
      • Apollo Connection
      • Models
      • Queries Mutations and Subscriptions
      • Caching Reponses
    • Integrating GraphQL Tools
      • GraphQL Code Generator
    • Feature Flags
      • Flag Structure & Storage
      • Website Integration
      • Apollo Integration
      • Tips and Techniques
      • Alternative Approaches
    • React Router
    • Adding Authentication
      • Create AAD Applications
      • Configure AAD For External Identities
      • Adding MSAL And React
      • Add MSAL to the build
      • Add MSAL to ApolloClient
      • Add MSAL to ApolloServer
    • Ant Design
    • Jest Tests
  • Azure Active Directory Business-to-Consumer (AD B2C)
    • Introduction
    • How to navigate through AD B2C documentation
    • Localization
    • Abbreviations
    • Azure AD B2C Extension
  • Cognitive Search
  • Cost Analysis
  • Technical Architecture
    • Identity and Access Control
  • Adding Functionality
    • Google Analytics
      • Create Analytics
    • DAPR
      • DAPR setup
      • DAPR Services (ignore for now)
        • Identity
  • Patterns and Practices
    • Idempotent Messages
    • Pathways
    • DDD
      • Initial Setup
        • Aggregate Root
        • Entity
        • Value Object
      • Field Types
        • Primitive Types
        • Non-Primitive Types
          • Types.DocumentArray
          • PopulatedDoc
          • Custom Types
      • Example Walkthrough
  • Open Items
    • Issue Tracking
  • Helpful Resources
  • DDD
    • Page 1
  • Experimental
    • StaticWebApp
    • Azure Maps
Powered by GitBook
On this page
  • Why Azure Storage for Static Websites
  • Create the Storage Account
  • Enable Static Website
  • Add a CDN to the Static Website
  • Create Multi-Origin CDN
  • Resources

Was this helpful?

  1. Initial Setup
  2. Infrastructure

Storage Account & CDN

(25 minutes)

PreviousConfigure Session BehaviorNextCDN Rules

Last updated 4 years ago

Was this helpful?

Why Azure Storage for Static Websites

For web applications which are entirely static (html/css/javascript) which leverage a separate stateless system for any dynamic data needs, hosting a website in from Azure Storage is an extremely cost effective solution.

In order to the host the website we'll create a storage account, configure it to host a website and set up a CDN, the CDN helps in delivering content quickly to visitors of the site.

Azure functions also rely on Azure Storage, one of these be used for the website as well as supporting the Azure function.

Create the Storage Account

Storage Account for Azure Function (US WEST2)

  • Navigate to in the Azure Portal

    • Select the subscription and the rg-sharethrift Resource Group created earlier.

    • Instance details:

      • Storage account name: sharethriftwest<<some random number>>

        • Be sure to replace <<some-random-number>> with a value, e.g. sharethriftwest123. Since storage account names need to be globally unique, you may need to try a few times before getting an unused number.

      • Location: (US) West US 2

      • Performance: Standard

      • Account kind: StorageV2 (general purpose V2)

      • Replication: Read-access geo-zone redundant storage RA-GRS

      • Click Next : Networking

    • Network connectivity

      • Connectivity method: Private Endpoint

      • Private Endpoint: <don't add anything at this time>

      • Network Routing: Microsoft network routing (default)

    • Click Review + Create

      • Click: Create (wait for it to be created)

Storage Account for Static Website and Azure Function (US EAST2)

    • Select the subscription and the rg-sharethrift Resource Group created earlier.

    • Instance details:

      • Storage account name: sharethrift<<some random number>>

        • Be sure to replace <<some-random-number>> with a value, e.g. sharethrift123. Since storage account names need to be globally unique, you may need to try a few times before getting an unused number.

      • Location: (US) East US 2

      • Performance: Standard

      • Account kind: General Purpose V2

      • Replication: Read-access geo-zone redundant storage RA-GZRS

      • Click Next : Networking

    • Network connectivity

      • Connectivity method: Public (all networks)

      • Private Endpoint: <don't add anything at this time>

      • Network Routing: Microsoft network routing (default)

    • Click Review + Create

      • Click: Create (wait for it to be created)

      • Click: Go to Resource

Enable Static Website

  • In the US East 2 storage account you just created, under select Static website in the navigation menu to the left under Settings

  • Select Enabled

  • Index document name: index.html

  • Error document path: index.html

  • Click Save

Add a CDN to the Static Website

  • In the storage account you just created, select Azure CDN in the navigation menu to the left.

  • CDN profile : Create New

  • CDN profile name: sharethrift

  • Pricing tier: Standard Microsoft

  • CDN endpoint name:

    • sharethrift-<<some random number>>(static website)

  • Origin Hostname (select the option with (static website) from the dropdown):

  • Click Create (wait)

Create Multi-Origin CDN

  • While still in the storage account you created, select Settings > Geo-replication in the navigation menu on the left

    • Under Storage Endpoints click View All

    • Note the Secondary static website endpoint (copy to a text document)

  • Navigate to the CDN just created

  • Create Origin Group

    • Under Settings > Origin - click + Create Origin Group, Add Origin Group panel shows

      • Origin group name: sharethrift-blobgroup

      • Probe status: Enabled

      • Probe path: /

      • Probe interval: 4 minute

      • Probe protocol: HTTPS

      • Probe method: Get

      • Default origin group: (checked)

      • Click Add (wait)

  • Add Second Origin

    • Still within Settings > Origin - click + Create Origin (the Add Origin panel shows)

      • Name: sharethrift-secondary-blob-core-windows-net

      • Origin type: Custom origin

      • Origin hostname: <<endpoint copied from earlier without the https:// and slash at end>>

      • Origin host header: <<same as origin hostname e.g.: sharethrift-secondary.z20.web.core.windows.net >>

      • HTTP port: 80

      • HTTPS port: 443

      • Priority: 1

      • Weight: 1000

      • Enabled: (checked)

      • Click Add (wait)

  • Assign Second Origin to Origin Group

    • Select the sharethrift-blobgroup you created earlier (Update Origin Group pane shows)

    • Under Origins click + Select Origin, a Select and origin to add dialog appears

      • Choose the second origin you just created from the dropdown and click OK

    • Click Save (wait)

(Optional) Add Custom Domain to the CDN

  • Navigate to the CDN just created, choose Custom Domains under Settings

    • Note the Endpoint hostname (e.g. sharetrift.azureedge.net), you'll use this in your DNS Settings

    • Log into your DNS Registrar's DNS settings, select your domain name (e.g. sharethrift.com)

      • Add two CNAME Records

        • Verification Record

          • CNAME: cdnverify

          • Points to: cdnverify.<<endpoint hostname>>

        • WWW Record

          • CNAME: www

          • Points to: <<endpoint hostname>>

    • Custom hostname: <<your domain name e.g.: www.sharethrift.com>>

    • Click Add

  • Add HTTPS to the domain

    • Select the custom domain you just created

    • Custom domain HTTPS: On

    • Certificate management type: CDN managed

    • Minimum TLS version: TLS 1.2

Resources:

  • Microsoft -

      • This couples well with the RA-GZRS blob website which is available in multiple regions.

Resources

  • Microsoft

Navigate to in the Azure Portal

(no longer in preview as of Jan 2021, available for production workloads)

Create Storage Account
Create Storage Account
Multi-origin CDN
Create a general-purpose storage account
Host a static website in Azure Storage
Integrate a static website with Azure CDN