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

Bias Types:
⚠️ powershell_heavy
⚠️ missing_linux_example
⚠️ windows_tools
⚠️ windows_first
Summary:
The documentation is heavily focused on PowerShell and Azure Automation runbooks using PowerShell scripts, with no mention of Linux alternatives or Bash/Azure CLI examples. All scripting and automation steps are described using PowerShell, and there is no guidance for users who may prefer or require Linux-based tooling or scripting environments. The documentation assumes familiarity with Azure PowerShell and does not provide parity for Linux users.
Recommendations:
  • Provide equivalent examples using Azure CLI (az) commands and Bash scripts for automation, especially for collecting ExpressRoute gateway route information.
  • Mention that Azure Automation supports Python runbooks and provide a sample Python script for the same monitoring task.
  • Clarify whether the described workflow is possible using Linux-based automation (e.g., using Azure CLI in Automation Accounts or Logic Apps) and provide instructions if so.
  • Add a section or note for Linux/macOS users, outlining how to perform the same steps without relying on PowerShell.
  • Where PowerShell modules are referenced, also reference Azure CLI equivalents and provide installation instructions for Linux environments.
  • Ensure that any prerequisites or 'before you begin' sections mention both PowerShell and CLI options, not just PowerShell.
GitHub Create pull request

Scan History

Date Scan ID Status Bias Status
2025-08-17 00:01 #83 in_progress ✅ Clean
2025-07-13 21:37 #48 completed ❌ Biased
2025-07-09 13:09 #3 cancelled ✅ Clean
2025-07-08 04:23 #2 cancelled ❌ Biased

Flagged Code Snippets

################# Input parameters ################# # Resource Group Name where the ExR GWs resides in $rgList= @('ASH-Cust10-02','ASH-Cust30') $thresholdNumRoutes = 160 ################################################### # Ensures you do not inherit an AzContext in your runbook Disable-AzContextAutosave -Scope Process | Out-Null Try { $conn = Get-AutomationConnection -Name 'AzureRunAsConnection' while(!($connectionResult) -And ($logonAttempt -le 5)) { $LogonAttempt++ # Logging in to Azure... $connectionResult = Connect-AzAccount ` -ServicePrincipal ` -ApplicationId $conn.ApplicationId ` -Tenant $conn.TenantId ` -CertificateThumbprint $conn.CertificateThumbprint ` -Subscription $conn.SubscriptionId ` -Environment AzureCloud Start-Sleep -Seconds 10 } } Catch { if (!$conn) { $ErrorMessage = "Service principal not found." throw $ErrorMessage } else { Write-Error -Message $_.Exception throw $_.Exception } } # Get the name of the Azure subscription $subscriptionName=(Get-AzSubscription -SubscriptionId $conn.SubscriptionId).Name #write-Output "<br>$(Get-Date) - selection of the Azure subscription: $subscriptionName" Select-AzSubscription -SubscriptionId $conn.SubscriptionId | Out-Null $GtwList = @() $results= @() foreach ($rgName in $rgList) { ## Collect all the ExpressRoute gateways in a Resource Group $GtwList=Get-AzVirtualNetworkGateway -ResourceGroupName $rgName ## For each ExpressRoute gateway, get the IP addresses of the BGP peers and collect the number of routes advertised foreach ($gw in $GtwList) { $peers = Get-AzVirtualNetworkGatewayBGPPeerStatus -VirtualNetworkGatewayName $gw.Name -ResourceGroupName $rgName if ($peers[0].State -eq 'Connected') { $routes1=$null $routes1 = Get-AzVirtualNetworkGatewayAdvertisedRoute -VirtualNetworkGatewayName $gw.Name -ResourceGroupName $rgName -Peer $peers[0].Neighbor } if ($peers[1].State -eq 'Connected') { $routes2=$null $routes2 = Get-AzVirtualNetworkGatewayAdvertisedRoute -VirtualNetworkGatewayName $gw.Name -ResourceGroupName $rgName -Peer $peers[1].Neighbor } $sampleTime=(Get-Date).ToString("dd-MM-yyyy HH:mm:ss") if ($routes1.Count -eq $routes2.Count) { if ($routes1.Count -lt $thresholdNumRoutes){ $status='OK' $alertMsg='number of routes below threshold' } else { $status='ALERT' $alertMsg='number of routes above threshold' } } else { $status='WARNING' $alertMsg='check ER Gateway' } $obj = [psCustomObject]@{ resourceGroup =$rgName nameGtw = $gw.Name peer1 = $peers[0].Neighbor peer2 = $peers[1].Neighbor numRoutesPeer1= $routes1.Count numRoutesPeer2= $routes2.Count time=$sampleTime status=$status alertMessage = $alertMsg } $results += $obj } ### end foreach gateways in each resource group } ### end foreach resource group $jsonResults= ConvertTo-Json $results -Depth 100 Write-Output $jsonResults