Deployment: On Azure App Service
This guide explains how to deploy DataStream on Azure App Service, Microsoft's fully managed platform for building, deploying, and scaling web applications. This deployment model offers simplified operations, automatic scaling, and reduced maintenance overhead.
Benefits
Deploying DataStream on Azure App Service provides several advantages:
- Fully managed infrastructure: No VM management or OS patching required
- Automatic scaling: Built-in auto-scaling based on load or schedule
- High availability: Guaranteed uptime with SLA backing
- Easy deployment: Multiple deployment options including CI/CD integration
- Cost efficiency: Pay only for the resources you use
Limitations to Consider
Before choosing App Service deployment, be aware of these limitations:
- Network ports: Limited control over networking (TCP/UDP listeners)
- Resource constraints: Maximum resource limits per App Service plan
- File system access: Restricted file system permissions in some cases
- Protocol support: Limited support for non-HTTP/HTTPS protocols
App Service Plan Selection
Choose the appropriate App Service plan based on your workload:
Plan | CPU(cores) | Memory (GB) | Recommended For |
---|---|---|---|
B1 | 1 | 1.75 | Development and testing |
P1V2 | 1 | 3.5 | Light production workloads |
P2V2 | 2 | 7 | Medium production workloads |
P3V2 | 4 | 14 | High-volume processing |
For production environments, Premium V2 or Premium V3 plans are recommended to ensure consistent performance.
Deployment Steps
1. Create Azure App Service
-
Navigate to the Azure Portal and create a new Web App -
- Select .NET 6 as the runtime stack
- Choose Linux as the operating system
- Select or create a new App Service Plan
- Enable Application Insights for monitoring
-
Configure deployment options - Select your preferred deployment method (GitHub Actions, Azure DevOps, or manual deployment)
-
Configure networking -
- Enable VNET integration if you need to connect to private networks
- Configure inbound traffic settings in the Networking section
2. Configure App Settings
Set up the required environment variables in the App Service Configuration:
-
Navigate to Configuration > Application settings and add the following:
Parameter Setting DATASTREAM_CONFIG_MODE
azure_blob
(to load config from blob storage)DATASTREAM_STORAGE_CONNECTION
Your Azure Storage connection string DATASTREAM_CONFIG_CONTAINER
Blob container name (e.g. datastream-config
)DATASTREAM_CONFIG_PATH
Path to config files (e.g. Director/config/
)Set also any additional secret values referenced in your configuration
-
Configure general settings -
- Set Always On to
On
to prevent the app from being unloaded - Configure appropriate platform settings (32-bit vs 64-bit)
- Set Always On to
3. Prepare Configuration Storage
-
Create an Azure Storage account if you don't have one -
- PowerShell (Windows)
- Bash (Linux/macOS)
az storage account create `
--name datastreamconfig `
--resource-group your-resource-group `
--location eastus `
--sku Standard_LRSaz storage account create \
--name datastreamconfig \
--resource-group your-resource-group \
--location eastus \
--sku Standard_LRS -
Create a blob container -
- PowerShell (Windows)
- Bash (Linux/macOS)
az storage container create `
--name datastream-config `
--account-name datastreamconfigaz storage container create \
--name datastream-config \
--account-name datastreamconfig -
Create and upload configuration files -
- PowerShell (Windows)
- Bash (Linux/macOS)
-
Create config directory
New-Item -ItemType Directory -Force -Path config
-
Create main config file
@"
devices:
- id: 1
name: http_collector
type: http
properties:
port: 8080
url: "/api/logs"
pipelines:
- name: basic_processing
processors:
- grok:
field: message
patterns:
- "%{COMMONAPACHELOG}"
targets:
- name: azure_storage
type: azure_blob
connection_string: "${DATASTREAM_STORAGE_CONNECTION_STRING}"
container: "datastream-logs"
"@|Out-File -FilePath config\config.yaml -Encoding utf8 -
Upload to blob storage
az storage blob upload-batch `
--account-name datastreamconfig `
--destination datastream-config `
--source config
-
Create config directory
mkdir -p config
-
Create main config file
cat > Director/config/config.yaml << EOF
devices:
- id: 1
name: http_collector
type: http
properties:
port: 8080
url: "/api/logs"
pipelines:
- name: basic_processing
processors:
- grok:
field: message
patterns:
- "%{COMMONAPACHELOG}"
targets:
- name: azure_storage
type: azure_blob
connection_string: "${DATASTREAM_STORAGE_CONNECTION_STRING}"
container: "datastream-logs"
EOF -
Upload to blob storage
az storage blob upload-batch \
--account-name datastreamconfig \
--destination datastream-config \
--source config
4. Deploy DataStream
Code Deployment
-
Download the DataStream Web deployment package -
- PowerShell (Windows)
- Bash (Linux/macOS)
Invoke-WebRequest -Uri "https://download.datastream.example.com/latest/datastream-webapp.zip" -OutFile "datastream-webapp.zip"
wget https://download.datastream.example.com/latest/datastream-webapp.zip
-
Deploy using the Azure CLI -
- PowerShell (Windows)
- Bash (Linux/macOS)
az webapp deployment source config-zip `
--resource-group your-resource-group `
--name your-app-name `
--src datastream-webapp.zipaz webapp deployment source config-zip \
--resource-group your-resource-group \
--name your-app-name \
--src datastream-webapp.zip
5. Configure App Service for DataStream
-
Update WebJobs configuration (if needed) -
- Create a
settings.job
file with appropriate cron expressions - Upload to the
wwwroot
directory
- Create a
-
Configure health check endpoint -
- Go to Health check in the App Service menu
- Set path to
/api/health
- Enable the health check feature
6. Verify Deployment
-
Check deployment status in the Azure Portal:
- Navigate to your App Service > Deployment Center
- Verify deployment status is successful
-
View application logs -
- Go to App Service > Monitoring > Log stream
- Check for successful startup messages
-
Test the HTTP endpoint -
- PowerShell (Windows)
- Bash (Linux/macOS)
$headers = @{
"Content-Type" = "application/json"
}
$body = @{
message = "test log message"
}|ConvertTo-Json
Invoke-RestMethod -Uri "https://your-app-name.azurewebsites.net/api/logs" -Method Post -Headers $headers -Body $bodycurl -X POST \
-H "Content-Type: application/json" \
-d '{"message":"test log message"}' \
https://your-app-name.azurewebsites.net/api/logs
Scaling and Performance
Optimize your App Service deployment with:
-
Auto-scaling rules:
- Navigate to Scale out (App Service plan)
- Configure rules based on CPU percentage, memory usage, or schedule
- Example: Add an instance when CPU > 70% for 10 minutes
-
Performance monitoring:
- Enable Application Insights for detailed performance metrics
- Configure alerts for abnormal conditions
-
Instance count settings:
- Minimum instances: 1 or more (for production workloads)
- Maximum instances: Based on expected peak load
Networking Considerations
For App Service deployments:
-
VNet Integration: Enable for secure connections to:
- Azure SQL, Redis, Service Bus, or other PaaS services
- On-premises resources via VPN Gateway
- Restrict outbound traffic using NSGs
-
Private Endpoints: Configure for:
- Secure connections from other Azure services
- Protection from public internet exposure
-
IP Restrictions: Limit access to specific IP ranges
Continuous Deployment
Set up CI/CD for your DataStream App Service:
-
GitHub Actions:
- Generate deployment profiles in the App Service portal
- Add secrets to your GitHub repository
- Create workflows for automated builds and deployments
-
Azure DevOps Pipelines:
- Connect your repository to Azure DevOps
- Create build and release pipelines
- Configure automated testing and staging environments
This deployment approach provides a balance of convenience and control, with minimal infrastructure management overhead.