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 Apps
and click on it.+ Create
>+ Container App
Container app name: e.g.
xlwings Lite
Deployment source:
Container image
Select the desired
Region
,Resource group
, andContainer Apps environment
. You may have to create theResource group
andEnvironment
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
to8000
Click on
Next: Tags
Click on
Next: Review + create
Click on
Create
You’ll find the
Application Url
under theOverview
menu item of your container app. UnderApplication
>Containers
activate theEnvironment variables
tab, then add the Application Url without the leadinghttps://
, it should look something like this:XLWINGS_HOSTNAME
:<name>.<random>.<location>.azurecontainerapps.io
Under
Application
>Scale
, you can set theMin replicas
andMax replicas
both 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-16"
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 type
selectOffice Add-in
.Select
Upload manifest file (.xml) from device
. ClickChoose File
, then select themanifest-xlwings-lite.xml
from the previous step.Click
Next
, then assign the desired users.Click
Next
and accept permission requests.Click
Next
andFinish 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).