3.3 KiB
Deploy to Azure App Service
Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile back ends.
The scripts (deploy.sh for bash and deploy.ps1 for powershell) under this folder are here to help deploy the docker image to Azure App Service.
This example demos how to deploy web-classification deploy a flow using Azure App Service.
Build a flow as docker format app
Use the command below to build a flow as docker format app:
pf flow build --source ../../flows/standard/web-classification --output dist --format docker
Note that all dependent connections must be created before building as docker.
Deploy with Azure App Service
The two scripts will do the following things:
- Create a resource group if not exists.
- Build and push the image to docker registry.
- Create an app service plan with the given sku.
- Create an app with specified name, set the deployment container image to the pushed docker image.
- Set up the environment variables for the app.
::::{tab-set} :::{tab-item} Bash Example command to use bash script:
bash deploy.sh --path dist -i <image_tag> --name my-app-23d8m -r <docker registry> -g <resource_group>
See the full parameters by bash deploy.sh -h.
:::
:::{tab-item} PowerShell
Example command to use powershell script:
.\deploy.ps1 -Path dist -i <image_tag> -n my-app-23d8m -r <docker registry> -g <resource_group>
See the full parameters by .\deploy.ps1 -h.
:::
::::
Note that the name will produce a unique FQDN as AppName.azurewebsites.net.
View and test the web app
The web app can be found via azure portal
After the app created, you will need to go to https://portal.azure.com/ find the app and set up the environment variables at (Settings>Configuration) or (Settings>Environment variables), then restart the app.
The app can be tested by sending a POST request to the endpoint or browse the test page. ::::{tab-set} :::{tab-item} Bash
curl https://<name>.azurewebsites.net/score --data '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -X POST -H "Content-Type: application/json"
::: :::{tab-item} PowerShell
Invoke-WebRequest -URI https://<name>.azurewebsites.net/score -Body '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -Method POST -ContentType "application/json"
::: :::{tab-item} Test Page Browse the app at Overview and see the test page:
Tips:
- Reach deployment logs at (Deployment>Deployment Central) and app logs at (Monitoring>Log stream).
- Reach advanced deployment tools at (Development Tools>Advanced Tools).
- Reach more details about app service at Azure App Service.
Next steps
- Try the example here.


