Which Fonts can you use on Azure App Service and Azure Functions, custom fonts

I remember the first time I converted the text in a Word document to Wingdings / dingbat font.  I thought I had come up with a secret code that I could share with my made Zork co-adventurers which described avoidance techniques of evil elvish wizard masters.  No one can forget about the hidden cave in Zork III which had the treasure chest that would replenish each time you left the cave, walking in and out over and over again to gain massive wealth.  Where am I going with this one…oh yes, Fonts…

Well, you know that Azure App Service is a PaaS product which means you cannot add anything at the system level, so you are, mostly dependent on the Fonts which exist there already.  Azure Functions is a server less offering, but the same PaaS restrictions apply here too.  Custom Fonts need access to GDI+ which is prohibited by the PaaS sandbox.  The question is, how do you see which Fonts are existing on the Virtual Machines (VM) which are running you Web App or Function?  While I’m at it, let’s ask two more questions, what is a use case which someone might want or need Fonts in some code and what can I do if I really want to run on PaaS, what are my options?

How to see which Fonts are on VM running a Web App or a Function

There is this Advanced tool called KUDU which I have written about for many years which gives you console access to the VM.  Access this tool using a browser.  If your App or Function name is csharpguitar, then the KUDU URL is https://csharpguitar.scm.azurewebsites.net, notice the SCM part…that is the important piece.  Navigate to the command and dump the d:\Windows\Fonts directory, as seen in Figure 1.

image

Figure 1, which Fonts are on VM running a Web App or a Function

Notice that the graphical dump of the directory contents can only show ~300, but if you DIR it, you can see them all.  But again to reiterate, you cannot add any new or additional fonts.  To install a Font requires console access and a higher level of access to the OS than what you have when running on PaaS.  Here are some instructions about how you would install Fonts on a Windows machine where you have the required permissions.

I thought came into my mind when I wrote that, “well, what permissions do you need specifically then?”, I don’t know off the top of my head, but here is how you can find that out –> Using Process Monitor to solve any problem.

I would expect that the fonts which exist on the PaaS VMs match this list.  But I didn’t go through and map them 1-1, but I don’t see 547 on that list.

Some use case scenarios

To be honest I think most use case scenarios for applications that need Fonts happen on client applications, like WinForms, WPF or Universal Apps.  From an internet or web application the content which is rendered on the client can use the fonts on that client device.  So, if I wanted to have all the content I browse the web in search for render as Wingdings, then I can do that, an no evil elf can stop me.  But, if for some reason your application needs to generate a PDF or another kind of documentation using data from a decoupled data store, then you might want or need the to identify the font you want to use during this process.  For example, I place an order, which sends the order details to an Event Hub that triggers an Azure Function.  That Function processes the order, generates a PDF receipt and emails it back to me, offline and decoupled.  The generation of the PDF would need some fonts, most likely use the default, already installed ones, but you might want or need a custom one.  (Is PDF generation supported on Azure PaaS?  See here and here.)

What other options do you have

Well, you can choose to run on IaaS which is your own VM which you would have access to (and the responsibility of) the OS.

And this option: Web App for Containers which lets you create and configure not only the application code you want to run on PaaS but also let’s you configure the OS level configurations, like adding Fonts.  Then you deploy the application code package and the container in which it runs.