Skip to main content
Version: 2.0.0

๐Ÿš€ Deploy on Azure

This article will help you to deploy your notification service to Azure. You can choose between the standard approach using a VM which is managed by yourself or to use an App Service which manages everything for you. But this comes with a higher price. Please follow the instructions step by step.


Azure provides free credits for students. More information here

๐Ÿ–ฅ๏ธ Deploy as VM#

To deploy the notification service in VM on Azure, make sure that you have ...

  1. an account on Azure and an active subscription.
  2. access to Azure Cloud Shell

Afterwards I refer to this article by Microsoft docs to setup a new Linux VM to avoid outdated information. You can stop as soon as you have shell access to your VM via SSH; You do not need to install a web server.

Then you can continue at the beginning of Deploy-with-Docker.

๐Ÿ†™ Deploy as App Service#

To deploy the notification service as App Service make sure that you have ...

  1. an account on Azure and an active subscription.
  2. access to Azure Cloud Shell or to a working az cli
  3. a .env file from these steps
  4. access to a MongoDB database like from MongoDB Atlas

Open the Azure Cloud Shell and you are ready


Docker has changed its rate limits on unauthenticated pull requests from Docker Hub. This can cause issues while using Docker Hub and Azure App Services. More information and a solution you can find here.

1. Get your wanted location and create new Resource Group#

If you not already have, set your default subscription.

az account set --subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Receive a list of all available locations with az account list-locations and choose your favorite location. Then use the following command to create a new resource group, replace westus with your selected location.

az group create --name notification-service-rg --location westus
az config set defaults.location=westus

The second command is used to set the default resource group and location. Please keep in mind that you need to changes these values if you are using the Azure CLI also for other projects.

2. Create an App Service Plan#

An Azure App Service plan can be described as the plan for the infrastructure your Azure App Service will use. So it will define your monthly costs. There are many different plans available - for this tutorial, we have chosen the B1 SKU. Feel free to change it for your needs.

az appservice plan create -n notification-service-asp --is-linux --sku B1

3. Create an App Service#

Choose a cool app name for the notification service. The name will be used for the final url https://[app name] Use this URL for the RP_ORIGIN and RP_ID in your .env (e.g RP_ORIGIN= Replace APP_NAME in every following command with your chosen name.

To create the app service and set the docker image, use the following command:

az webapp create -p notification-service-asp -i -n APP_NAME

Next step is to apply the environment variables. Therefore you have two options. Before you continue, make sure that your .env values does not contain any whitespace or special characters like $, () or #.

If your file is located in your working directory in your Azure Cloud Shell you can execute the next command as the first option (How Cloud Shell storage works and Transfer local files to Cloud Shell):

az webapp config appsettings set --settings $(<.env) -n APP_NAME

If not, it becomes a bit more work, as you need to apply each line of .env to the following command (KEY=value pairs are separated by a whitespace)

az webapp config appsettings set -n APP_NAME --settings MONGO_HOST=mongodb://mongo:27017/fmdb MOODLE_BASE_URL=https://moodle...

Validate the output that every variable has been set correctly. Additional variables displayed like DOCKER_REGISTRY_SERVER_URL just ignore them.

To know, whats going on with your Notification Service, use the following command to active the logging. You will need the logs to get your registration token.

az webapp log config --application-logging filesystem --docker-container-logging filesystem --web-server-logging off -n APP_NAME

โœ… Yeah!#

Wow, you have successfully deploy your own Notification Service on Azure! Now you are ready to get started. Open the web interface to trigger the initialization process with az webapp browse --name APP_NAME and then use the commands from the next section to open the logs and get your registration token!

๐Ÿ“œ Access logs#

You can either access the logs via -> Open the new app service -> Log stream or by using the following command:

az webapp log tail -n APP_NAME