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 provides only PowerShell-based examples for interacting with the Azure REST API, with no equivalent examples for Linux or cross-platform tools such as Azure CLI or curl. The workflow assumes the use of Windows tools and patterns (e.g., PowerShell cmdlets, Windows file paths), and does not mention or prioritize Linux or cross-platform alternatives.
Recommendations:
- Add equivalent examples using Azure CLI and/or curl for sending the PATCH request, suitable for Linux/macOS users.
- Include bash shell scripting examples alongside PowerShell to ensure parity.
- Use platform-neutral file path examples or clarify paths for both Windows and Linux.
- Mention both PowerShell and CLI/curl options in the introduction to REST API usage, rather than focusing solely on PowerShell.
- Ensure that authentication steps are described for both PowerShell and Azure CLI (e.g., az login).
Create pull request
Flagged Code Snippets
$subscriptionID = "subscriptionID"
$resourceGroup = "resourceGroupName"
$automationAccount = "automationAccountName"
$file = "path\body_remove_sa.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
# Select-AzSubscription -SubscriptionId "<SUBSCRIPTIONID>"
# build URI
$URI = "https://management.azure.com/subscriptions/$subscriptionID/resourceGroups/$resourceGroup/providers/Microsoft.Automation/automationAccounts/$automationAccount`?api-version=2020-01-13-preview"
# build body
$body = Get-Content $file
# 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 PATCH -Headers $authHeader -Body $body
# Confirm removal
(Get-AzAutomationAccount `
-ResourceGroupName $resourceGroup `
-Name $automationAccount).Identity.Type