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 biased towards Windows and PowerShell. All scripting examples are provided only in PowerShell (.ps1), and users are explicitly instructed to select PowerShell in Azure Cloud Shell, with no mention of Bash or cross-platform alternatives. There are no Linux shell or CLI examples, and the workflow assumes familiarity with Windows-centric tools and patterns.
Recommendations:
  • Provide equivalent Bash or Azure CLI script examples for Linux/macOS users.
  • Update instructions to mention both Bash and PowerShell options in Azure Cloud Shell, and clarify that either can be used where possible.
  • Include notes about running scripts on Linux/macOS, including any prerequisites or differences in authentication or file handling.
  • Where PowerShell-specific cmdlets are used, suggest cross-platform alternatives or clarify if the script is compatible with PowerShell Core on Linux/macOS.
  • Avoid language that assumes Windows as the default environment (e.g., 'save the file locally as PS1 file') and instead use neutral, cross-platform phrasing.
GitHub Create pull request

Scan History

Date Scan ID Status Bias Status
2025-07-12 23:44 #41 in_progress ❌ Biased
2025-07-12 00:58 #8 cancelled ✅ Clean
2025-07-10 05:06 #7 processing ✅ Clean

Flagged Code Snippets

## Define source target mapping for ## 1. Tenant ## 2. Billing Account ## 3. Billing Profile ## 4. Invoice Sections ##(source) MCA-E details $tenantId = "" $billingAccount="" $billingProfile = "" ##(destination) MCA-E details $targetBillingProfile = "" $targetTenantId = "" $targetbillingAccount="" ## Invoice section mapping in hash table $hash = @{ "" = ""; #invoice section 1 "" = ""; #invoice section 2 } ## Connect to Azure account using device authentication using tenantId Connect-AzAccount -UseDeviceAuthentication -TenantId $tenantId Set-AzContext -TenantId $tenantId ## Acquire access token for the current user $var = Get-AzAccessToken $auth = 'Bearer ' + $var.Token #### Get Billing Account Role Assignments from source MCA-E #define parameters for REST API call $params = @{ Uri = "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/"+ $billingAccount +"/billingRoleAssignments?api-version=2019-10-01-preview" Headers = @{ 'Authorization' = $auth } Method = 'GET' ContentType = 'application/json' } #### Call API with parameters defined above $ret = Invoke-RestMethod @params ####Initialize array lists $ArrayListBARoles = [System.Collections.Generic.List[string]]::new(); $ArrayListBPRoles = [System.Collections.Generic.List[string]]::new(); $ArrayListISRoles = [System.Collections.Generic.List[string]]::new(); #### Add each billing account role and principal id to array list #### Push down the billing account role assignments to billing profile role assignments (replacing 5 series with 4 series) foreach($j in $ret.value){ $BANameArrayArray= $j.name -replace "500000", "500000" #-split '_' foreach($i in $BANameArrayArray){ $ArrayListBARoles.Add($i) } } #### Get Billing Role assignments for billing profile $paramsBPRoleAssignments = @{ Uri = "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/"+$billingAccount +"/billingProfiles/" +$billingProfile +"/billingRoleAssignments?api-version=2019-10-01-preview" Headers = @{ 'Authorization' = $auth } Method = 'GET' ContentType = 'application/json' } $retBPRoles = Invoke-RestMethod @paramsBPRoleAssignments ####add each role to arraylist foreach($k in $retBPRoles.value){ $BPNameArrayArray= $k.name #-split '_' foreach($l in $BPNameArrayArray){ $ArrayListBPRoles.Add($l) } } #### Get Invoice sections for billing profile $invoiceSections = Get-AzInvoiceSection -BillingAccountName $billingAccount -BillingProfile $billingProfile for ($ii=0; $ii -lt $ArrayListBARoles.count; $ii=$ii+1){ $paramsBARoleCreation = @{ Uri = "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/"+$targetbillingAccount+"/createBillingRoleAssignment?api-version=2020-12-15-privatepreview" Headers = @{ 'Authorization' = $auth } Method = 'POST' ContentType = 'application/json' } $BodyBARoleCreation = @{ principalTenantId = $tenantId roleDefinitionId = "/providers/Microsoft.Billing/billingAccounts/" +$targetbillingAccount +"/" +($ArrayListBARoles[$ii] -SPLIT '_')[0] principalId=($ArrayListBARoles[$ii] -SPLIT '_')[1] } $retBARoles = Invoke-RestMethod @paramsBARoleCreation -body @($BodyBARoleCreation | ConvertTo-Json) } #BILLING PROFILE for ($ii=0; $ii -lt $ArrayListBPRoles.count; $ii=$ii+1){ $paramsBPRoleCreation = @{ Uri = "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/" +$targetbillingAccount +"/billingProfiles/"+ $targetBillingProfile +"/createBillingRoleAssignment?api-version=2020-12-15-privatepreview" Headers = @{ 'Authorization' = $auth } Method = 'POST' ContentType = 'application/json' } $BodyBPRoleCreation = @{ principalTenantId = $tenantId roleDefinitionId = "/providers/Microsoft.Billing/billingAccounts/" +$targetbillingAccount +"/billingProfiles/"+ $targetBillingProfile +"/" +($ArrayListBPRoles[$ii] -SPLIT '_')[0] principalId=($ArrayListBPRoles[$ii] -SPLIT '_')[1] } $retBPRoles = Invoke-RestMethod @paramsBPRoleCreation -body @($BodyBPRoleCreation | ConvertTo-Json) } #INVOICE SECTIONS $targetinvoiceSection="" #Get Roles for each invoice section foreach ($m in $invoiceSections){ if ($hash.ContainsKey($m.Name)){ $targetinvoiceSection=$hash[$m.Name] 'targetinvoiceSection' $targetinvoiceSection $paramsISRoleAssignments = @{ Uri = "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/" +$billingAccount +"/billingProfiles/" + $billingProfile +"/invoiceSections/" +$m.Name+ "/billingRoleAssignments?api-version=2019-10-01-preview" Headers = @{ 'Authorization' = $auth } Method = 'GET' ContentType = 'application/json' } $retISRoles = Invoke-RestMethod @paramsISRoleAssignments $ISNameArrayArray=$null $ArrayListISRoles = [System.Collections.Generic.List[string]]::new(); foreach($n in $retISRoles.value){ $ISNameArrayArray= $n.name #-split '_' foreach($o in $ISNameArrayArray){ $ArrayListISRoles.Add($o) } } for ($ii=0; $ii -lt $ArrayListISRoles.count; $ii=$ii+1){ $paramsISRoleCreation = @{ Uri = "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/" +$targetbillingAccount+ "/billingProfiles/"+ $targetBillingProfile +"/invoiceSections/"+ $targetinvoiceSection +"/createBillingRoleAssignment?api-version=2020-12-15-privatepreview" Headers = @{ 'Authorization' = $auth } Method = 'POST' ContentType = 'application/json' } $BodyISRoleCreation = @{ principalTenantId = $tenantId roleDefinitionId = "/providers/Microsoft.Billing/billingAccounts/" +$targetbillingAccount +"/billingProfiles/"+ $targetBillingProfile +"/invoiceSections/"+ $targetinvoiceSection+ "/" +($ArrayListISRoles[$ii] -SPLIT '_')[0] #userEmailAddress = ($graph.UserPrincipalName -Replace '_', '@' -split '#EXT#@' )[0] principalId=($ArrayListISRoles[$ii] -SPLIT '_')[1] } $resISRolesCreation= Invoke-RestMethod @paramsISRoleCreation -body @($BodyISRoleCreation | ConvertTo-Json) } } }