Azure App Service is a product offered by Microsoft Azure that offers the deployment of web applications in a Docker container on an Azure Virtual Machine. In its current configuration, the product comes in two flavors:
- Deployment from code
- Deployment from a Dockerfile
In the case of "Deployment from code", the material inside of the folder to be deployed is zipped and automatically packaged into a Dockerfile.
For more information: Quickstart: Create a Python app - Azure App Service | Microsoft Docs
How to use the Web Licensing Service with Azure App Service
Since machine-based licensing is not available in a dockerized environment, the Docker container has to receive a token that authorizes it to run Gurobi. The Web Licensing Service (WLS) provides such a token that is renewed in fixed intervals.
In case of deployment from a Dockerfile, it is quite straightforward to either put the gurobi.lic file in the default location or to choose an alternative location and set the GRB_LICENSE_FILE environment variable (see here).
However, if you deploy directly from code, then you do not have access to the underlying configuration options used in the Dockerfile. Therefore, you should set the license parameters via the API. For Python, this may look as follows:
import gurobipy as gp
env = gp.Env(empty=True)
env.setParam('WLSACCESSID',<access-id from gurobi.lic file>)
env.setParam('WLSSECRET', <secret from gurobi.lic file>)
env.setParam('LICENSEID', <your license id>)