Skip to content

Latest commit

 

History

History

azure-ts-serverless-www-html

Azure Native Deploying Static Site in TypeScript using StorageAccountStaticWebsite

Deploy an Azure Native static site in TypeScript deployed using with StorageAccountStaticWebsite.

Deployment

  1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step)

    az login
  2. Create a new stack:

    pulumi stack init dev
  3. Install dependencies

    npm install
  4. Configure the location to deploy the resources to. The Azure region to deploy to is pre-set to WestUS - but you can modify the region you would like to deploy to.

    pulumi config set azure-native:location eastus2

    pulumi config set allows us to pass in configuration values from the command line. Feel free to choose any Azure region that supports the services used in these labs (see this infographic for current list of available regions). A list of some of the regions:

    centralus,eastasia,southeastasia,eastus,eastus2,westus,westus2,northcentralus,southcentralus,
    westcentralus,northeurope,westeurope,japaneast,japanwest,brazilsouth,australiasoutheast,australiaeast,
    westindia,southindia,centralindia,canadacentral,canadaeast,uksouth,ukwest,koreacentral,koreasouth,
    francecentral,southafricanorth,uaenorth,australiacentral,switzerlandnorth,germanywestcentral,
    norwayeast,jioindiawest,australiacentral2

    The command updates and persists the value to the local Pulumi.dev.yaml file. You can view or edit this file at any time to effect the configuration of the current stack.

  5. Run pulumi up to preview and select yes to deploy changes:

    pulumi up
     Previewing update (dev)
    
     Updating (dev)
    
     View Live: https://app.pulumi.com/shaht/azure-ts-serverless-www-html/dev/updates/77
    
         Type                                                       Name                              Status      
     +   pulumi:pulumi:Stack                                        azure-ts-serverless-www-html-dev  created     
     +   ├─ azure-native:resources:ResourceGroup                    demo-rg                           created     
     +   │  └─ azure-native:storage:StorageAccount                  demosa                            created     
     +   │     └─ azure-native:storage:StorageAccountStaticWebsite  demo-staticwebsite                created     
     +   ├─ azure-native:storage:Blob                               index.html                        created     
     +   └─ azure-native:storage:Blob                               404.html                          created     
     
     Outputs:
         resource_group_name : "demo-rgac8b82c7"
         staticEndpoint      : "https://demosa57132147.z20.web.core.windows.net/"
         storage_account_name: "demosa57132147"
    
     Resources:
         + 6 created
    
     Duration: 29s
  6. Check the deployed function endpoints via pulumi stack output

    pulumi stack output endpoint

    Results

    Current stack outputs (3):
    OUTPUT                VALUE
    resource_group_name   demo-rgac8b82c7
    staticEndpoint        https://demosa57132147.z20.web.core.windows.net/
    storage_account_name  demosa5713214

    You can now open the resulting endpoint in the browser or curl it:

    curl $(pulumi stack output staticEndpoint)

    Welcome to Pulumi!!! This is Infrastructure as Code. This file is served from Azure Native.

  7. Clean up - Destroy the Stack

    pulumi destoy -y
  8. Remove the stack

    pulumi stack rm dev