Azure Container Apps

This guide shows how to deploy xlwings Lite to Azure Container Apps. You can use the Azure Dashboard or the Azure CLI or a combination of the two approaches.

Azure Dashboard

  1. Get an xlwings trial license key

  2. Go to https://portal.azure.com/

  3. Search for Container Apps and click on it.

  4. + Create > + Container App

    • Container app name: e.g. xlwings Lite

    • Deployment source: Container image

    • Select the desired Region, Resource group, and Container Apps environment. You may have to create the Resource group and Environment first.

    • Click on Next: Container

    • Image source: Docker Hub or other registries

    • Image type: Public

    • Registry login server: docker.io

    • Image and tag: xlwings/xlwings-lite:1.0.0.0-16

    • CPU and memory: 0.5 CPU cores, 1 Gi memory

    • Environment variables: XLWINGS_LICENSE_KEY: your-license-key

    • Click on Next: Ingress

    • Select Enabled

      • Set the appropriate values under Ingress traffic

      • Set Target port to 8000

    • Click on Next: Tags

    • Click on Next: Review + create

    • Click on Create

  5. You’ll find the Application Url under the Overview menu item of your container app. Under Application > Containers activate the Environment variables tab, then add the Application Url without the leading https://, it should look something like this: XLWINGS_HOSTNAME: <name>.<random>.<location>.azurecontainerapps.io

  6. Under Application > Scale, you can set the Min replicas and Max replicas both to 1. Under Application > Containers, under CPU and memory, you can choose 0.5 CPU cores, 1 Gi memory.

  7. Go to your Application Url. You should see This is an xlwings Lite app!.

  8. Continue with Add-in installation

Azure CLI

Prerequisites

Setup Environment Variables

Note that some of these values have to be changed, as they have to be globally unique.

export RESOURCE_GROUP_NAME="xlwings-lite-rg"
export APP_NAME="xlwings-lite"
export ENVIRONMENT_NAME="xlwings-lite-env"
export LOCATION="westeurope"
export XLWINGS_LITE_VERSION="1.0.0.0-16"
export XLWINGS_LICENSE_KEY="your-license-key-here"

Deployment Steps

  1. Create Resource Group if you don’t want to reuse an existing one

    az group create \
      --name $RESOURCE_GROUP_NAME \
      --location $LOCATION
    
  2. Create Container Apps Environment if you don’t want to reuse an existing one (you may need to specify more options if you want to expose this on an virtual network)

    az containerapp env create \
      --name $ENVIRONMENT_NAME \
      --resource-group $RESOURCE_GROUP_NAME \
      --location $LOCATION
    
  3. Create Container App

    az containerapp create \
      --name $APP_NAME \
      --resource-group $RESOURCE_GROUP_NAME \
      --image docker.io/xlwings/xlwings-lite:$XLWINGS_LITE_VERSION \
      --environment $ENVIRONMENT_NAME \
      --min-replicas 1 \
      --max-replicas 1 \
      --cpu 0.5 \
      --memory 1.0Gi \
      --target-port 8000 \
      --ingress external
    

    Note

    This will expose the application to the public internet. If you have an Azure Virtual Network, you have to set --ingress internal.

  4. Update the Container App with environment variables

    FQDN=$(az containerapp show --name $APP_NAME --resource-group $RESOURCE_GROUP_NAME --query properties.configuration.ingress.fqdn -o tsv)
    
    az containerapp update \
    --name $APP_NAME \
    --resource-group $RESOURCE_GROUP_NAME \
    --image xlwings/xlwings-lite:$XLWINGS_LITE_VERSION \
    --set-env-vars XLWINGS_LICENSE_KEY=$XLWINGS_LICENSE_KEY XLWINGS_HOSTNAME=$FQDN
    
  5. Continue with Add-in installation

View Application Logs

az containerapp logs show \
 --name $APP_NAME \
 --resource-group $RESOURCE_GROUP_NAME \
 --follow

Cleanup

If you want to get rid of everything again that you created in this CLI walkthrough, you can delete all resources like so:

az group delete --name $RESOURCE_GROUP_NAME --yes --no-wait

Add-in installation

  1. Go to <Application Url>/manifest.xml. In your browser, go to File > Save Page As (or similar) and save the XML file somewhere locally, e.g., under the name manifest-xlwings-lite.xml. It’s a good idea to open the XML file in an editor and double-check that e.g., <IconUrl> contains the correct Application Url.

  2. Go to Microsoft 365 admin center

    • Click on Show all > Settings > Integrated Apps, then click on Upload custom apps.

    • As App type select Office Add-in.

    • Select Upload manifest file (.xml) from device. Click Choose File, then select the manifest-xlwings-lite.xml from the previous step.

    • Click Next, then assign the desired users.

    • Click Next and accept permission requests.

    • Click Next and Finish deployment.

The users should get the add-in to show up automatically although it may take a few minutes until they show up. Alternatively, they can go to Add-ins on the ribbon’s Home tab and click on More Add-ins. They will see the add-in under the tab Admin Managed from where they can install it (there’s also a Refresh button at the top right).