SSW Foursquare

Orphaned Rules - 2 Rules


The rules listed below have no parent category
  1. Do you use module templates in your Bicep code?

    When teams start with Bicep, it’s tempting to keep everything in a single large .bicep file. While this works for small experiments, it quickly becomes unmanageable in real-world solutions. Changes become risky, duplication creeps in, and debugging is painful.

    That’s why using Bicep modules—small, reusable templates—is the recommended approach. Modules let you break down complex infrastructure into logical components, making your code easier to maintain, test, and share across projects.

    Why use module templates?

    • Reusability – Define resources once and reuse them across environments (e.g. dev, test, prod).
    • Maintainability – Smaller files are easier to read and troubleshoot.
    • Consistency – Teams can follow the same patterns, reducing misconfiguration.
    • Scalability – Large deployments can be composed of well-tested building blocks.

    Example: Without vs With Modules

    // main.bicep (all-in-one)
    resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
      name: 'myuniquestorage'
      location: resourceGroup().location
      sku: {
        name: 'Standard_LRS'
      }
      kind: 'StorageV2'
    }
    
    resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
      name: 'myappinsights'
      location: resourceGroup().location
      kind: 'web'
      properties: {
        Application_Type: 'web'
      }
    }

    Figure: Bad Example - Multiple resources jammed into a single main module, hard to maintain and reuse

    // storageAccount.bicep (module)
    param storageName string
    param location string
    
    resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
      name: storageName
      location: location
      sku: {
        name: 'Standard_LRS'
      }
      kind: 'StorageV2'
    }
    
    // appInsights.bicep (module)
    param appInsightsName string
    param location string
    
    resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
      name: appInsightsName
      location: location
      kind: 'web'
      properties: {
        Application_Type: 'web'
      }
    }
    
    // main.bicep
    module storage './storageAccount.bicep' = {
      name: 'storageDeployment'
      params: {
        storageName: 'myuniquestorage'
        location: resourceGroup().location
      }
    }
    
    module appInsights './appInsights.bicep' = {
      name: 'appInsightsDeployment'
      params: {
        appInsightsName: 'myappinsights'
        location: resourceGroup().location
      }
    }

    Figure: Good Example - A clean main module calling smaller reusable modules for storage and application insights

    Best practices for modules

    • Keep modules small – A module should represent a logical unit (e.g. a storage account, app service, or network).
    • Use parameters and outputs – Define clear inputs and outputs so modules are flexible.
    • Version control – Store commonly used modules in a shared repo or registry.
    • Validate early – Test modules in isolation before plugging them into larger deployments.

    By treating your Bicep modules like building blocks, you create a clean, reusable infrastructure-as-code foundation that grows with your projects.

  2. Do you use Azure Migrate and App Service Migration Assistant before migrating your app to the cloud?

    Migrating legacy applications to Azure without first performing a readiness assessment can lead to unexpected failures or hidden blockers. Using Azure’s App Service Migration Assistant, an on-premises web application was assessed and packaged for migration efficiently through Microsoft’s PowerShell scripts.

    By following this structured, automated approach, migrations are faster, clearer, and more predictable.

    Why use Azure Migrate + App Service Migration Assistant?

    ✅ Pros

    • Fast process – Full assessment and packaging completed within 30-60 minutes when paired with SysAdmin who had the knowledge of the application's on-premises server.
    • Clear, actionable reports – Output is easy to interpret, helping teams resolve migration blockers quickly.
    • Repeatable and scalable – Scripts are well-documented, ideal for reuse across multiple migrations.

    Scripts used:

    1. Get-SiteReadiness.ps1 – Assesses suitability for Azure App Service, checking:

      • Configuration errors
      • Location tag issues
      • HTTPS binding setup
    2. Get-SitePackage.ps1 – Packages the site for migration.
    3. Generate-MigrationSettings.ps1 – Generates deployment configuration files.

    Figure: Good Example – A clear, script-driven process with consistent output.

    ⚠️ Cons

    • Requires local administrator access – Scripts must be run directly on the server (coordination with SysAdmin required) dev cannot do this by himself.
    • No remote execution – Assessment cannot be initiated remotely.

    Recommendation

    Use Azure Migrate and the App Service Migration Assistant before migrating any web application to Azure. This toolset helps identify blockers early and reduces time spent resolving avoidable issues during actual migration.

    For web applications, always run the assessment scripts in advance and generate migration packages using Microsoft’s tools. This will help your team feel more confident in the migration process and avoid unnecessary surprises.

    Useful Resources

We open source.Loving SSW Rules? Star us on GitHub. Star
Stand by... we're migrating this site to TinaCMS