How To: Configure a gateway for routing internet traffic

Learn how to expose a service to the internet via a gateway

This guide will walk you through how to setup a gateway for routing internet traffic to a service.


Step 1: Define a container

Begin by defining the service you wish to expose to the internet in a new file named app.bicep. This example uses the Radius demo container:

import radius as rad

@description('The application ID being deployed. Injected automtically by the rad CLI')
param application string

resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
  name: 'frontend'
  properties: {
    application: application
    container: {
      image: ''
      ports: {
        web: {
          containerPort: 3000

Step 2: Add a gateway

Next, add a gateway to app.bicep, routing traffic to the root path ("/") to the frontend container. Note that when a hostname is not specified one is generated automatically.

resource gateway 'Applications.Core/gateways@2023-10-01-preview' = {
  name: 'gateway'
  properties: {
    application: application
    routes: [
        path: '/'
        destination: 'http://${}:3000'

Step 3: Deploy the app

Deploy the application with rad deploy:

rad deploy app.bicep -a gatewaydemo

The gateway endpoint will be printed at the end of the deployment:

Building app.bicep...
   Deploying template './app.bicep' for application 'gatewaydemo' and environment 'default' from workspace 'default'...

   Deployment In Progress...

   Completed            gateway         Applications.Core/gateways
   Completed            frontend        Applications.Core/containers

   Deployment Complete

      gateway         Applications.Core/gateways
      frontend        Applications.Core/containers

    Public endpoint

Step 4: Interact with the application

Visit the endpoint to interact with the demo Radius container:


Cleanup the application with ‘rad app delete’:

rad app delete gatewaydemo -y

Further reading