Skip to content

Free guide

Set up your first Azure Container App

Run a sample web server, find its address and see which revision serves the request.

Why it matters

A container image is a package. Your app needs a place to run it and a way to send a request to the port where it listens.

Core concepts

Environment

An environment hosts container apps and jobs. A resource group holds the Azure resources you want to manage together.

Ingress

Ingress directs traffic to the listening port inside the container. This exercise creates a public endpoint for Microsoft’s sample image. Use sample data. Creating resources may incur charges.

Try it step by step

  1. Use Bash in Azure Cloud Shell. Confirm the selected subscription with az account show. Use a fresh practice group called rg-fieldwork-lab.
  2. Update the containerapp extension and register Microsoft.App and Microsoft.OperationalInsights in your practice subscription if needed. Wait until both show Registered.
  3. Run the command below. Open the returned host over HTTPS. You should see the sample page.
  4. In the portal, open the app, find Revisions and replicas, then match the active revision to its image. When finished with all three labs, review the contents of your dedicated group and remove the lab resources.

Use the Bash example in a dedicated practice subscription or resource group. Check the result in the portal and keep the expected and actual outcomes together.

Worked example

A server listens on 80 inside the image. A visitor opens the HTTPS address. Azure handles the incoming connection and forwards the request to that port.

Azure CLI · Bash
az containerapp up \
  --name fieldwork-web --resource-group rg-fieldwork-lab \
  --environment fieldwork-env --location centralus \
  --image mcr.microsoft.com/k8se/quickstart:latest \
  --ingress external --target-port 80 \
  --query properties.configuration.ingress.fqdn -o tsv

Common mistake

Setting the target port to 443 simply because the visitor uses HTTPS.

Practice exercise

Sketch the route from the browser to the running container. Label where the hostname and target port belong.

Check your understanding

Which port should the ingress target?

  1. The port the process listens on
  2. Always 443
  3. The database port
Show answer

The port the process listens on. The target port must match the listening process.

Takeaway

The target port must match the listening process.

Further reading

Browse more lessons