description |
---|
(~17 minutes) |
-
App service plans (ASPs) allow the function to run for an extended period of time - and most times can be more affordable to run than the Consumption plan.
-
Navigate to the Create App Service Plan resource in the Azure Portal
-
Select the appropriate Subscription and the rg-sharethrift resource group
-
App Service Plan details
- Name: service-east2-<<random-number>>
- ** when creating for west 2 use service-west2-<<random-number>
- Operating System: Linux
- Region: East US 2
- **when creating for west 2 use West US 2
- Name: service-east2-<<random-number>>
-
Pricing Tier
- Sku and size: B1 (located under category of Dev / Test) ~$12.41/mo
Repeat the same process above, but instead make the following changes
- App Service Plan Name:
- service-west2-<<random-number>
- Select the Region:
- US West 2
-
Start by creating an app service plan - we're selecting the minimal to get us going:
-
Navigate to the Create Function App resource in the Azure Portal
-
Select the appropriate Subscription and the rg-sharethrift resource group
-
Instance Details
- Function App Name: data-access-east2-<<random-number>>
- ** when creating for west 2 use data-access-west2<<random-number>>
- Publish: code
- Runtime Stack: Node.js
- Version: 16 LTS (Preview)
- Region: East US 2
- ** when creating for west 2 use West US 2
- Choose Next : Hosting >
- Function App Name: data-access-east2-<<random-number>>
-
Hosting Details:
- Storage Account: (select the sharethrift<random number> storage account created earlier)
- ** when creating for west 2 select the sharethriftwest<random number> account
- Operating System: linux
- Plan type: App service plan
- Linux Plan: service-east2 (B1)
- Choose Next: Networking (preview) > Monitoring
- Storage Account: (select the sharethrift<random number> storage account created earlier)
-
Application Insights:
- Enable Application Insights: Yes
- Application Insights: sharethrift (East US 2)
- ** when creating for west 2 select sharethriftwest (West US 2)
- Choose Review + Create
- Choose Create (wait for it to complete)
- Choose Go to resource
-
Add App Settings for improved performance
- In the function app just created navigate to Configuration
- Choose + New Application Setting for each of the following
- Ensure the Node App gets rebuilt on the Linux VM that runs the function when deployed
- Name: SCM_DO_BUILD_DURING_DEPLOYMENT
- Value: true
- Name: ENABLE_ORYX_BUILD
- Value: true
- Do not add the following - these no longer seem to work..
- Ensure the Node App gets rebuilt on the Linux VM that runs the function when deployed
- Choose Save
- Choose Continue (wait until completion)
-
Add CORS headers
- In the function app just created navigate to CORS
- Check the Enable Access-Control-Allow-Credentials
- Add the URL of the website created in the CDN step
- e.g. https://sharethrift\.azureedge.net/
-
Add System Assigned Identity
- In the function app just created navigate to Settings > Identity
- Under System Assigned, Status : Select On
- Choose Save - a dialog confirming your choice will appear, click Yes, wait for it complete.
- Click the Azure Role Assignments button:
- You will be taken to the Azure Role Assignments Blade
- Click Add role assignment (preview)
- In the Add Role Assignment blade
- Scope: Key Vault
- Subscription: (choose the appropriate subscription)
- Resource: sharethrift
- Role: Key Vault Secrets User (preview)
Repeat the same process above, but instead make the following changes
- Name the function:
- data-access-west2<<random-number>>
- Select the Region:
- US West 2
- Select the storage account:
- sharethriftwest<random number> storage account created earlier
- Select the application insights:
- sharethriftwest (West US 2)
Keyvault Settings
- Need to add Get permissions on secret for the 2 identities you just created
Resources
- Microsoft