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_tools
⚠️
missing_linux_example
⚠️
windows_first
Summary:
The documentation page is heavily focused on Azure PowerShell cmdlets and Windows-centric tooling, with all examples and recommendations provided exclusively in PowerShell. There is no mention of Linux-native tools, Bash, or cross-platform scripting approaches. The guidance assumes the use of PowerShell and does not address how context switching or runbook management would be handled in Linux environments or with other automation languages supported by Azure Automation.
Recommendations:
- Provide equivalent examples using Azure CLI (az) commands, which are cross-platform and commonly used in Linux environments.
- Include Bash or Python runbook examples to demonstrate context management outside of PowerShell.
- Explicitly mention that Azure Automation supports multiple runbook types (PowerShell, Python, Graphical, etc.) and clarify if context switching issues are unique to PowerShell or apply to other languages.
- Reorganize sections to present cross-platform solutions first or in parallel, rather than focusing solely on Windows/PowerShell.
- Reference Linux tools or patterns where appropriate, and ensure troubleshooting steps and error messages are relevant to both Windows and Linux users.
Create pull request
Flagged Code Snippets
Get-AzVM : The client '<clientid>' with object id '<objectid>' does not have authorization to perform action 'Microsoft.Compute/virtualMachines/read' over scope '/subscriptions/<subscriptionIdOfSubscriptionWhichDoesntContainTheVM>/resourceGroups/REsourceGroupName/providers/Microsoft.Compute/virtualMachines/VMName '.
ErrorCode: AuthorizationFailed
StatusCode: 403
ReasonPhrase: Forbidden Operation
ID : <AGuidRepresentingTheOperation> At line:51 char:7 + $vm = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $UNBV... +
# Ensures you do not inherit an AzContext in your runbook
Disable-AzContextAutosave -Scope Process
# Connect to Azure with system-assigned managed identity
$AzureContext = (Connect-AzAccount -Identity).context
# set and store context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription -DefaultProfile $AzureContext
# Pass context object - even though the context had just been set
# This is the step that guarantees the context will not be switched.
Get-AzVM -ResourceGroupName "resourceGroupName" -DefaultProfile $AzureContext | Select Name
Get-AzureRmResource : Resource group "SomeResourceGroupName" could not be found.
... resources = Get-AzResource -ResourceGroupName $group.ResourceGro ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzResource], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResourceCmdlet