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-17CPU 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-17"
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
Add-in installation¶
Go to
<Application Url>/manifest.xml. In your browser, go toFile>Save Page As(or similar) and save the XML file somewhere locally, e.g., under the namemanifest-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.Go to Microsoft 365 admin center
Click on
Show all>Settings>Integrated Apps, then click onUpload custom apps.As
App typeselectOffice Add-in.Select
Upload manifest file (.xml) from device. ClickChoose File, then select themanifest-xlwings-lite.xmlfrom the previous step.Click
Next, then assign the desired users.Click
Nextand accept permission requests.Click
NextandFinish 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).