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¶
Get an xlwings trial license key
Search for
Container Appsand click on it.+ Create>+ Container AppContainer app name: e.g.
xlwings LiteDeployment source:
Container imageSelect the desired
Region,Resource group, andContainer Apps environment. You may have to create theResource groupandEnvironmentfirst.Click on
Next: ContainerImage source:
Docker Hub or other registriesImage type:
PublicRegistry login server:
docker.ioImage and tag:
xlwings/xlwings-lite:1.0.0.0-69CPU and memory:
0.5 CPU cores, 1 Gi memoryEnvironment variables:
XLWINGS_LICENSE_KEY:your-license-keyClick on
Next: IngressSelect
EnabledSet the appropriate values under
Ingress trafficSet
Target portto8000
Click on
Next: TagsClick on
Next: Review + createClick on
Create
You’ll find the
Application Urlunder theOverviewmenu item of your container app. UnderApplication>Containersactivate theEnvironment variablestab, then add the Application Url without the leadinghttps://, it should look something like this:XLWINGS_HOSTNAME:<name>.<random>.<location>.azurecontainerapps.ioUnder
Application>Scale, you can set theMin replicasandMax replicasboth to1. UnderApplication>Containers, underCPU and memory, you can choose0.5 CPU cores, 1 Gi memory.Go to your Application Url. You should see
This is an xlwings Lite app!.Continue with
add-in-installation
Azure CLI¶
Prerequisites¶
Azure CLI installed and logged in (
az login)An xlwings license key
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-69"
export XLWINGS_LICENSE_KEY="your-license-key-here"
Deployment Steps¶
Create Resource Group if you don’t want to reuse an existing one
az group create \ --name $RESOURCE_GROUP_NAME \ --location $LOCATION
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
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.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
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
Register the add-in with Microsoft 365 admin center¶
In your browser, go to
https://<your-hostname>/manifest, which will downloadxlwings-lite-manifest.xml.Go to Microsoft 365 admin center
Click on
Show all>Settings>Integrated Apps.If you have xlwings Lite installed, uninstall it first.
Click on
Upload custom appsand selectOffice Add-in(App type).Select
Upload manifest file (.xml) from device. ClickChoose File, then select thexlwings-lite-manifest.xmlfrom the previous step.Click
Next, then assign the desired users.Click
Nextand accept permission requests.Click
NextandFinish deployment.
The users will get the add-in to show up automatically although it may take a few hours.
Note
If you want to remove the add-in again and run into issues (“Remove apps failed. No apps were successfully removed. Please try to remove them later.”), use this legacy URL: https://admin.microsoft.com/#/Settings/AddIns