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
⚠️
windows_first
⚠️
missing_linux_example
⚠️
windows_tools
Summary:
The documentation exclusively uses PowerShell scripts and Windows-centric tooling (Az PowerShell module) for all steps, including authentication, request construction, and REST invocation. There are no examples or instructions for Linux or cross-platform environments (e.g., Bash, Azure CLI, curl). This creates a strong Windows and PowerShell bias, potentially alienating users on Linux or macOS.
Recommendations:
- Provide equivalent examples using Bash shell with curl or HTTPie for REST API calls.
- Include Azure CLI (az) commands for authentication and token retrieval, which are cross-platform.
- Explicitly mention that the instructions are valid on Windows and provide a parallel section for Linux/macOS users.
- Avoid requiring the Az PowerShell module as the only prerequisite; suggest alternatives like Azure CLI.
- Where file paths are referenced (e.g., path\body.json), use POSIX-style paths or clarify for both Windows and Linux.
- Add a note about cross-platform compatibility and link to relevant Azure REST API usage guides for Linux/macOS.
Create pull request
Flagged Code Snippets
# Invoke the REST API
$response = Invoke-RestMethod -Uri $URI -Method PUT -Headers $authHeader -Body $body
# Review output
$response | ConvertTo-Json
$subscription = "subscriptionID"
$resourceGroup = "resourceGroupName"
$labName = "labName"
$file = "path\body.json"
# Sign in to your Azure subscription
$sub = Get-AzSubscription -ErrorAction SilentlyContinue
if(-not($sub))
{
Connect-AzAccount
}
# If you have multiple subscriptions, set the one to use
# Set-AzContext -SubscriptionId $subscription
# build URI
$URI = "https://management.azure.com/subscriptions/$subscription/resourceGroups/$resourceGroup/providers/Microsoft.DevTestLab/labs/$labName`?api-version=2018-09-15"
# build body
$body = Get-Content $file
$subscription = "subscriptionID"
$resourceGroup = "resourceGroupName"
$labName = "labName"
# build URI
$URI = "https://management.azure.com/subscriptions/$subscription/resourceGroups/$resourceGroup/providers/Microsoft.DevTestLab/labs/$labName`?api-version=2018-09-15"
# obtain access token
$azContext = Get-AzContext
$azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile)
$token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId)
$authHeader = @{
'Content-Type'='application/json'
'Authorization'='Bearer ' + $token.AccessToken
}
# Invoke the REST API
Invoke-RestMethod -Uri $URI -Method DELETE -Headers $authHeader
$azContext = Get-AzContext
$azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile)
$token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId)
$authHeader = @{
'Content-Type'='application/json'
'Authorization'='Bearer ' + $token.AccessToken
}