Skip to main content

Azure Deployment Setup

Satélite API is deployed on Azure Web Services, providing high availability and scalability for both production and testing environments.

Available Environments

Satélite API runs on two dedicated Azure Web Services instances:

Production Server

https://sateliteappapi.azurewebsites.netLive environment for production operations

Testing Server

https://sateliteappapi-test.azurewebsites.netDevelopment and testing environment

Prerequisites

Before deploying to Azure, ensure you have:
  • Azure subscription with active account
  • Azure CLI installed locally
  • .NET 6.0 SDK installed
  • SQL Server databases configured
  • Valid connection strings for all database contexts

Deployment Steps

1

Prepare the Application

Build the application in Release mode:
dotnet build -c Release
Run tests to ensure everything works:
dotnet test
2

Configure Azure Web App

Create or select your Azure Web App:
# Login to Azure
az login

# Create resource group (if not exists)
az group create --name satelite-rg --location eastus

# Create App Service plan
az appservice plan create \
  --name satelite-plan \
  --resource-group satelite-rg \
  --sku B1 \
  --is-linux

# Create Web App
az webapp create \
  --name sateliteappapi \
  --resource-group satelite-rg \
  --plan satelite-plan \
  --runtime "DOTNETCORE:6.0"
3

Configure Application Settings

Set environment variables in Azure Portal:
  1. Navigate to your Web App in Azure Portal
  2. Go to Configuration > Application settings
  3. Add the following settings:
See the Configuration page for detailed settings.
# Set environment via Azure CLI
az webapp config appsettings set \
  --name sateliteappapi \
  --resource-group satelite-rg \
  --settings ASPNETCORE_ENVIRONMENT="Production"
4

Configure Connection Strings

Add connection strings in the Azure Portal:
  1. Go to Configuration > Connection strings
  2. Add each database connection string:
    • SateliteConnection
    • CajachicaConnection
    • ConsolidadoConnection
    • AnticiposConnection
    • CuboComercialConnection
    • NexusConnection
    • CentinelaConnection
Never commit connection strings to source control. Always use Azure Key Vault or App Settings for sensitive data.
5

Deploy the Application

Deploy using Azure CLI:
# Publish the application
dotnet publish -c Release -o ./publish

# Create deployment package
cd publish
zip -r ../deploy.zip .
cd ..

# Deploy to Azure
az webapp deployment source config-zip \
  --name sateliteappapi \
  --resource-group satelite-rg \
  --src deploy.zip
Alternatively, use Visual Studio or GitHub Actions for automated deployments.
6

Verify Deployment

Test the GraphQL endpoint:
curl https://sateliteappapi.azurewebsites.net/graphql
You should receive a response indicating the GraphQL server is running.Access the GraphQL playground in your browser:
https://sateliteappapi.azurewebsites.net/graphql

Environment Variables

The application uses the ASPNETCORE_ENVIRONMENT variable to determine the environment:
ASPNETCORE_ENVIRONMENT=Production
The testing environment uses the Quality environment name as configured in launchSettings.json.

Continuous Deployment with GitHub Actions

For automated deployments, create a GitHub Actions workflow:
.github/workflows/azure-deploy.yml
name: Deploy to Azure

on:
  push:
    branches:
      - main

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v2
    
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '6.0.x'
    
    - name: Build
      run: dotnet build -c Release
    
    - name: Publish
      run: dotnet publish -c Release -o ./publish
    
    - name: Deploy to Azure
      uses: azure/webapps-deploy@v2
      with:
        app-name: 'sateliteappapi'
        publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
        package: ./publish

Monitoring and Diagnostics

1

Enable Application Insights

Add Application Insights to monitor performance:
az monitor app-insights component create \
  --app sateliteappapi-insights \
  --location eastus \
  --resource-group satelite-rg
2

Configure Logging

Enable diagnostic logs in Azure Portal:
  1. Go to Monitoring > Diagnostic settings
  2. Enable:
    • Application logs
    • Web server logs
    • Detailed error messages
3

View Logs

Access logs via Azure CLI:
az webapp log tail \
  --name sateliteappapi \
  --resource-group satelite-rg

Scaling Configuration

Configure auto-scaling for production workloads:
# Enable auto-scale
az monitor autoscale create \
  --resource-group satelite-rg \
  --resource satelite-plan \
  --resource-type Microsoft.Web/serverfarms \
  --name satelite-autoscale \
  --min-count 2 \
  --max-count 5 \
  --count 2

# Add scale rule based on CPU
az monitor autoscale rule create \
  --resource-group satelite-rg \
  --autoscale-name satelite-autoscale \
  --condition "Percentage CPU > 70 avg 5m" \
  --scale out 1

Troubleshooting

Check the following:
  1. Verify all connection strings are correctly configured
  2. Ensure the runtime version matches (.NET 6.0)
  3. Check Application Insights logs for startup errors
  4. Verify all required environment variables are set
Common causes:
  • Incorrect connection string format
  • Firewall rules blocking Azure IP addresses
  • SQL Server not allowing Azure services
Solution: Add Azure IP ranges to SQL Server firewall:
az sql server firewall-rule create \
  --resource-group <sql-rg> \
  --server <sql-server> \
  --name AllowAzureServices \
  --start-ip-address 0.0.0.0 \
  --end-ip-address 0.0.0.0
Performance optimization:
  1. Enable connection pooling in database contexts
  2. Implement DataLoader for N+1 query problems
  3. Add appropriate database indexes
  4. Configure query execution timeout in Program.cs:272-304

Next Steps

Configuration

Configure connection strings and application settings

Environments

Learn about environment-specific configurations