Our PDF generation service ran perfectly on local dev machines but crashed constantly on Azure. Functions timed out, rendering failed with cryptic GDI+ errors, and deployments mysteriously broke working code.
The issue wasn't IronPDF—it was Azure configuration. Here's how to deploy IronPDF successfully on Azure.
Does IronPDF Work on Azure?
Yes, but you need the right tier and configuration. Iron PDF works on:
- Azure App Service (Basic B1 tier or higher)
- Azure Functions (Premium or Dedicated plan)
- Azure WebJobs
- Azure Container Instances (Linux or Windows containers)
IronPDF does NOT work on:
- Free/Shared App Service tiers
- Consumption plan Functions
Why? Free tiers restrict User32/GDI+ APIs required for PDF rendering.
using IronPdf;
// Install via NuGet: Install-Package IronPdf
// Works on Azure App Service Basic B1+
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Azure Test</h1>");
pdf.SaveAs("output.pdf");
What Azure Plan Do I Need?
App Service: Basic B1 minimum ($13/month)
Functions: Premium EP1 or Dedicated plan
Container Apps: Any tier (containers bypass restrictions)
I run IronPDF on Basic B1 App Service for low-traffic sites and Premium Functions for high-throughput API endpoints.
How Do I Deploy to Azure Functions?
Use IronPdf.Slim package for Functions:
Install-Package IronPdf.Slim
Configure function:
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using IronPdf;
public class PdfGenerator
{
[Function("GeneratePdf")]
public async Task<HttpResponseData> Run(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req)
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Function PDF</h1>");
var response = req.CreateResponse();
response.Headers.Add("Content-Type", "application/pdf");
await response.WriteBytesAsync(pdf.BinaryData);
return response;
}
}
Deploy to Premium or Dedicated plan.
Why IronPdf.Slim Instead of IronPdf?
IronPdf.Slim omits Chromium binaries from the package. Azure Functions downloads them at runtime, avoiding deployment size limits.
Use IronPdf.Slim when:
- Deploying as ZIP (Run from package enabled)
- Function size exceeds limits
- Linux deployments
Use standard IronPdf when:
- Run from package is disabled
- Windows deployments with local binaries
How Do I Deploy to Linux App Service?
Install IronPdf.Linux package:
Install-Package IronPdf.Linux
Configure app settings in Azure Portal:
IRONPDF_BROWSER_PATH=/usr/bin/chromium-browser
Deploy normally. Linux App Service has fewer restrictions than Windows.
What About Containers?
Containers are the most reliable option. Use official IronPDF Docker images or build custom:
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY . .
# Install Chromium dependencies
RUN apt-get update && apt-get install -y \
chromium \
libgdiplus \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["dotnet", "MyApp.dll"]
Deploy to Azure Container Instances or App Service containers.
Why Do I Get "Run from Package" Errors?
When "Run from package" is enabled, Azure deploys your app as a read-only ZIP. IronPDF needs write access to extract Chromium binaries.
Solution 1: Disable "Run from package" in App Service Configuration
Solution 2: Use IronPdf.Slim which downloads binaries to writable temp directories
I prefer Solution 2 to avoid deployment mode changes.
How Do I Handle Timeout Errors?
Azure Functions have default timeouts (5 minutes Consumption, 30 minutes Premium). PDF generation can exceed these for complex documents.
Increase timeout in host.json:
{
"version": "2.0",
"functionTimeout": "00:10:00"
}
Or process PDFs asynchronously with durable functions or queue triggers.
Can I Use Azure Blob Storage for Output?
Yes. Generate PDFs and upload to Blob Storage:
using Azure.Storage.Blobs;
using IronPdf;
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Report</h1>");
var blobClient = new BlobClient(connectionString, "pdfs", "report.pdf");
using (var stream = new MemoryStream(pdf.BinaryData))
{
await blobClient.UploadAsync(stream, overwrite: true);
}
// Return blob URL
string url = blobClient.Uri.ToString();
Users download PDFs from Blob Storage instead of blocking the function.
How Do I Debug Azure Deployment Issues?
Enable Application Insights logging:
using Microsoft.ApplicationInsights;
var telemetry = new TelemetryClient();
try
{
var pdf = renderer.RenderHtmlAsPdf(html);
}
catch (Exception ex)
{
telemetry.TrackException(ex);
throw;
}
Common errors:
- GDI+ errors: Wrong tier (upgrade to B1+)
- File not found: Run from package issue
- Timeout: Increase timeout or use async processing
What About Memory Limits?
PDF rendering uses significant memory. Monitor with Application Insights:
var renderer = new ChromePdfRenderer();
// Limit concurrent renders
var semaphore = new SemaphoreSlim(2); // Max 2 concurrent
await semaphore.WaitAsync();
try
{
var pdf = renderer.RenderHtmlAsPdf(html);
return pdf;
}
finally
{
semaphore.Release();
}
Scale out (more instances) instead of scale up (bigger instances) for high throughput.
Can I Use Managed Identity for Authentication?
Yes, when accessing Azure resources:
using Azure.Identity;
using Azure.Storage.Blobs;
// Use managed identity instead of connection strings
var blobClient = new BlobServiceClient(
new Uri("https://account.blob.core.windows.net"),
new DefaultAzureCredential()
);
This works regardless of IronPDF usage.
How Do I Deploy via CI/CD?
Azure DevOps pipeline example:
trigger:
- main
pool:
vmImage: 'windows-latest'
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
- task: AzureWebApp@1
inputs:
azureSubscription: 'MySubscription'
appName: 'my-pdf-app'
package: '$(Build.ArtifactStagingDirectory)/**/*.zip'
deploymentMethod: 'zipDeploy'
Use zipDeploy for IronPDF apps (recommended deployment method).
What's the Cost Impact?
Basic B1: ~$13/month base + bandwidth
Premium EP1 Function: ~$150/month + executions
Optimize costs:
- Use Basic B1 for low traffic
- Scale to Premium only when needed
- Cache generated PDFs in Blob Storage
- Use serverless (Premium Functions) for spiky workloads
I run 10,000 PDF/month on Basic B1 App Service for under $20/month total.
Does This Work with Azure Static Web Apps?
Static Web Apps can't run IronPDF directly (no server-side execution). Use Azure Functions as backend:
Static Web App → Function API → IronPDF → PDF
The Static Web App calls a Function endpoint that generates PDFs.
Written by Jacob Mellor, CTO at Iron Software. Jacob created IronPDF and leads a team of 50+ engineers building .NET document processing libraries.
Top comments (0)