Sad Tux - Windows bias detected
This page contains Windows bias

About This Page

This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.

Bias Analysis

Detected Bias Types
powershell_heavy
windows_first
missing_linux_example
windows_tools
Summary
The documentation is heavily biased toward Windows and PowerShell. All command-line examples use PowerShell, and instructions reference Windows-specific tools and file paths (e.g., c:/temp). There are no examples or guidance for Linux or cross-platform users, despite Azure CLI being mentioned briefly. The image customization steps use Windows images and PowerShell scripts exclusively, with no mention of Linux equivalents or how to adapt the process for Linux environments.
Recommendations
  • Provide parallel examples using Azure CLI and Bash for all PowerShell commands, ensuring Linux and macOS users can follow along.
  • Include instructions for installing Azure CLI and required modules on Linux, not just PowerShell on Windows.
  • Demonstrate how to create and customize Linux images with Azure VM Image Builder, including sample templates and scripts.
  • Use cross-platform file paths (e.g., /tmp/mytemplate.txt) or clarify file path differences for Windows and Linux.
  • When referencing tools like Chocolatey (Windows), also mention Linux package managers (e.g., apt, yum) for Linux image customization scenarios.
  • Explicitly state which steps or features are Windows-only and provide alternatives or links for Linux users where possible.
GitHub Create Pull Request

Scan History

Date Scan Status Result
2025-07-12 23:44 #41 cancelled Biased Biased
2025-07-12 00:58 #8 cancelled Clean Clean
2025-07-10 05:06 #7 processing Clean Clean

Flagged Code Snippets

   'Az.ImageBuilder', 'Az.ManagedServiceIdentity' | ForEach-Object {Install-Module -Name $_ -AllowPrerelease}
   
   # Gallery name 
   $galleryName= "devboxGallery" 

   # Image definition name 
   $imageDefName ="vscodeImageDef" 

   # Additional replication region 
   $replRegion2="eastus" 

   # Create the gallery 
   New-AzGallery -GalleryName $galleryName -ResourceGroupName $imageResourceGroup -Location $location 

   $SecurityType = @{Name='SecurityType';Value='TrustedLaunch'} 
   $features = @($SecurityType) 

   # Create the image definition
   New-AzGalleryImageDefinition -GalleryName $galleryName -ResourceGroupName $imageResourceGroup -Location $location -Name $imageDefName -OsState generalized -OsType Windows -Publisher 'myCompany' -Offer 'vscodebox' -Sku '1-0-0' -Feature $features -HyperVGeneration "V2" 
   
   New-AzResourceGroupDeployment  -ResourceGroupName $imageResourceGroup  -TemplateFile $templateFilePath  -Api-Version "2020-02-14"  -imageTemplateName $imageTemplateName  -svclocation $location 
   
      Get-AzResourceProvider -ProviderNamespace Microsoft.VirtualMachineImages | Format-table -Property ResourceTypes,RegistrationState 
      Get-AzResourceProvider -ProviderNamespace Microsoft.Storage | Format-table -Property ResourceTypes,RegistrationState  
      Get-AzResourceProvider -ProviderNamespace Microsoft.Compute | Format-table -Property ResourceTypes,RegistrationState 
      Get-AzResourceProvider -ProviderNamespace Microsoft.KeyVault | Format-table -Property ResourceTypes,RegistrationState 
      Get-AzResourceProvider -ProviderNamespace Microsoft.Network | Format-table -Property ResourceTypes,RegistrationState 
   
      Register-AzResourceProvider -ProviderNamespace Microsoft.VirtualMachineImages  
      Register-AzResourceProvider -ProviderNamespace Microsoft.Storage  
      Register-AzResourceProvider -ProviderNamespace Microsoft.Compute  
      Register-AzResourceProvider -ProviderNamespace Microsoft.KeyVault  
      Register-AzResourceProvider -ProviderNamespace Microsoft.Network 
   
   # Get existing context 
   $currentAzContext = Get-AzContext

   # Get your current subscription ID  
   $subscriptionID=$currentAzContext.Subscription.Id

   # Destination image resource group  
   $imageResourceGroup="<Resource group>"

   # Location  
   $location="eastus2"

   # Image distribution metadata reference name  
   $runOutputName="aibCustWinManImg01"

   # Image template name  
   $imageTemplateName="vscodeWinTemplate"  
   
   # Set up role definition names, which need to be unique 
   $timeInt=$(get-date -UFormat "%s") 
   $imageRoleDefName="Azure Image Builder Image Def"+$timeInt 
   $identityName="aibIdentity"+$timeInt 
    
   # Add an Azure PowerShell module to support AzUserAssignedIdentity 
   Install-Module -Name Az.ManagedServiceIdentity 
    
   # Create an identity 
   New-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $identityName -Location $location
    
   $identityNameResourceId=$(Get-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $identityName).Id 
   $identityNamePrincipalId=$(Get-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $identityName).PrincipalId
   
   $aibRoleImageCreationUrl="https://raw.githubusercontent.com/azure/azvmimagebuilder/master/solutions/12_Creating_AIB_Security_Roles/aibRoleImageCreation.json" 
   $aibRoleImageCreationPath = "aibRoleImageCreation.json" 
   
   # Download the configuration 
   Invoke-WebRequest -Uri $aibRoleImageCreationUrl -OutFile $aibRoleImageCreationPath -UseBasicParsing 
   ((Get-Content -path $aibRoleImageCreationPath -Raw) -replace '<subscriptionID>',$subscriptionID) | Set-Content -Path $aibRoleImageCreationPath 
   ((Get-Content -path $aibRoleImageCreationPath -Raw) -replace '<rgName>', $imageResourceGroup) | Set-Content -Path $aibRoleImageCreationPath 
   ((Get-Content -path $aibRoleImageCreationPath -Raw) -replace 'Azure Image Builder Service Image Creation Role', $imageRoleDefName) | Set-Content -Path $aibRoleImageCreationPath 
   
   # Create a role definition 
   New-AzRoleDefinition -InputFile  ./aibRoleImageCreation.json

   # Grant the role definition to the VM Image Builder service principal 
   New-AzRoleAssignment -ObjectId $identityNamePrincipalId -RoleDefinitionName $imageRoleDefName -Scope "/subscriptions/$subscriptionID/resourceGroups/$imageResourceGroup" 
   
   {
      "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "imageTemplateName": {
         "type": "string"
        },
        "api-version": {
         "type": "string"
        },
        "svclocation": {
         "type": "string"
        }
      },
      "variables": {},
      "resources": [
        {
         "name": "[parameters('imageTemplateName')]",
         "type": "Microsoft.VirtualMachineImages/imageTemplates",
         "apiVersion": "[parameters('api-version')]",
         "location": "[parameters('svclocation')]",
         "dependsOn": [],
         "tags": {
           "imagebuilderTemplate": "win11multi",
           "userIdentity": "enabled"
         },
         "identity": {
           "type": "UserAssigned",
           "userAssignedIdentities": {
            "<imgBuilderId>": {}
           }
         },
         "properties": {
           "buildTimeoutInMinutes": 100,
           "vmProfile": {
            "vmSize": "Standard_DS2_v2",
            "osDiskSizeGB": 127
           },
         "source": {
            "type": "PlatformImage",
            "publisher": "MicrosoftWindowsDesktop",
            "offer": "Windows-11",
            "sku": "win11-21h2-ent",
            "version": "latest"
         },
           "customize": [
            {
               "type": "PowerShell",
               "name": "Install Choco and VS Code",
               "inline": [
                  "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))",
                  "choco install -y vscode"
               ]
            }
           ],
            "distribute": 
            [
               {   
                  "type": "SharedImage",
                  "galleryImageId": "/subscriptions/<subscriptionID>/resourceGroups/<rgName>/providers/Microsoft.Compute/galleries/<sharedImageGalName>/images/<imageDefName>",
                  "runOutputName": "<runOutputName>",
                  "artifactTags": {
                     "source": "azureVmImageBuilder",
                     "baseosimg": "win11multi"
                  },
                  "replicationRegions": [
                    "<region1>",
                    "<region2>"
                  ]
               }
            ]
         }
        }
      ]
     }
   
   $templateFilePath = <Template Path>
   
   (Get-Content -path $templateFilePath -Raw ) -replace '<subscriptionID>',$subscriptionID | Set-Content -Path $templateFilePath 
   (Get-Content -path $templateFilePath -Raw ) -replace '<rgName>',$imageResourceGroup | Set-Content -Path $templateFilePath 
   (Get-Content -path $templateFilePath -Raw ) -replace '<runOutputName>',$runOutputName | Set-Content -Path $templateFilePath  
   (Get-Content -path $templateFilePath -Raw ) -replace '<imageDefName>',$imageDefName | Set-Content -Path $templateFilePath  
   (Get-Content -path $templateFilePath -Raw ) -replace '<sharedImageGalName>',$galleryName| Set-Content -Path $templateFilePath  
   (Get-Content -path $templateFilePath -Raw ) -replace '<region1>',$location | Set-Content -Path $templateFilePath  
   (Get-Content -path $templateFilePath -Raw ) -replace '<region2>',$replRegion2 | Set-Content -Path $templateFilePath  
   ((Get-Content -path $templateFilePath -Raw) -replace '<imgBuilderId>',$identityNameResourceId) | Set-Content -Path $templateFilePath 
   
   Invoke-AzResourceAction  -ResourceName $imageTemplateName  -ResourceGroupName $imageResourceGroup  -ResourceType Microsoft.VirtualMachineImages/imageTemplates  -ApiVersion "2020-02-14"  -Action Run
   
    Get-AzImageBuilderTemplate -ImageTemplateName $imageTemplateName -ResourceGroupName $imageResourceGroup | Select-Object -Property Name, LastRunStatusRunState, LastRunStatusMessage, ProvisioningState 
    
    Name                 LastRunStatusRunState    LastRunStatusMessage   ProvisioningState
    ---------------------------------------------------------------------------------------
    vscodeWinTemplate                                                    Creating