Decide a suffix for the solution, it should contain four letters, eg. "mawi". Whenever [suffix] is used below, replace the [suffix] with the four letters.
Navigate to the apps folder and create a new app. Choose CSS as stylesheet and enable SSR.
ng new [suffix]-app
az group create -n rg-[suffix] -l swedencentral
Open the main.bicep file and change the default value for the name parameter to the [suffix] that has been chosen. Navigate to the bicep folder and run the following command.
az deployment group create -g rg-[suffix] -f main.bicep
Run the following command.
az storage blob service-properties update --account-name stg[suffix]1234 --static-website --index-document index.html
Navigate to the app folder and run the following commands.
ng build
az storage blob upload-batch --account-name stg[suffix]1234 --destination '$web' --source dist/[suffix]-app
If changes are made to the code and the command needs to be run again, run the following command first.
az storage blob delete-batch --account-name stg[suffix]1234 --source '$web'
Use a browser and navigate to the app https://stg[suffix]1234.z1.web.core.windows.net/browser
Create a Azure Front Door service with the following configuration using bicep
- origin group
- origin
- endpoint
- route
Open main.bicep and set the "deployafd" parameter to true, navigate to the bicep folder and run the command.
az deployment group create -g rg-[suffix] -f main.bicep
Use a browser and navigate to the app using the afd endpoint address. Get the endpoint address through the Azure portal, copy the "Endpoint hostname" https://ep-[suffix]-[generatedletters].b01.azurefd.net
Open main.bicep and set the "deploywaf" parameter to true, navigate to the bicep folder and run the command.
az deployment group create -g rg-[suffix] -f main.bicep
Go to the Azure portal and find the API Management instance "apim-[suffix]. Goto "APIs", choose OpenAPI, click on "Select a file", choose the file "swapi.json" in the bicep folder, enter "swapi" as the API URL suffix, click Create.
An API has been created.
Open main.bicep and set the "deployapi" parameter to true, navigate to the bicep folder and run the command.
az deployment group create -g rg-[suffix] -f main.bicep
Use a browser or a REST client and navigate to https://ep-[suffix]-[generatedletters].b01.azurefd.net/api/people/1
It fails, check the logs in log analytics, check the value in the field "originUrl_s".
Find the commented lines in main.bicep and uncomment them.
// ruleSets: [
// {
// id: ruleSet.id
// }
// ]
Set the "deployruleset" parameter to true and run the command.
az deployment group create -g rg-[suffix] -f main.bicep
Use a browser or a REST client and navigate to https://ep-[suffix]-[generatedletters].b01.azurefd.net/api/people/1



