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 is heavily focused on PowerShell-based automation, with all code examples and troubleshooting steps using PowerShell cmdlets and modules (e.g., Az.Automation, Get-AzVM, Connect-AzAccount). There is no mention of Linux-specific tools, shell environments, or examples using Bash, Azure CLI, or Python (except for a brief mention of Python runbooks in one error message). Windows/PowerShell patterns and tools are presented exclusively, with no Linux or cross-platform parity.
Recommendations:
- Add equivalent troubleshooting steps and code examples for Linux environments, such as using Bash scripts or Azure CLI commands.
- Include Python runbook examples and troubleshooting guidance, especially since Python is supported in Azure Automation.
- Clearly indicate when a solution or workaround is PowerShell-specific, and provide alternatives for Linux users where possible.
- Reference cross-platform tools (e.g., Azure CLI) alongside PowerShell, and provide guidance for both environments.
- Mention any platform-specific limitations or differences in behavior between Windows and Linux Hybrid Runbook Workers.
- Where PowerShell modules are referenced, note if they are available on PowerShell Core (cross-platform) or only on Windows PowerShell.
Create pull request
Flagged Code Snippets
Run Login-AzureRMAccount to login.
$job = Start-AzAutomationRunbook `
-AutomationAccountName "MyAccount" `
-ResourceGroupName "MyRG" `
-Name "ReusableTaskRunbook" `
-Parameters @{ TaskId = '1234' }
#Optional: Wait for job completion
do {
Start-Sleep -Seconds 5
$jobStatus = Get-AzAutomationJob -Id $job.Id -AutomationAccountName "MyAccount" -ResourceGroupName "MyRG"} while ($jobStatus.Status -ne "Completed")
start-azautomationRunbook -Name "Test_2" -AutomationAccountName "AutomationParent" -ResourceGroupName "AutomationAccount"
get-azvm : 'this.Client.SubscriptionId' cannot be null. At line:5 char:1 + get-azvm + ~~~~~~~~ + CategoryInfo : CloseError: (:) [Get-AzVM], ValidationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.GetAzureVMCommand
No certificate was found in the certificate store with thumbprint
$Cred = Get-Credential
#Using Azure Service Management
Add-AzureAccount -Credential $Cred
#Using Azure Resource Manager
Connect-AzAccount -Credential $Cred
The term 'Connect-AzAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if the path was included verify that the path is correct and try again.
$logonAttempt = 0
$logonResult = $False
while(!($connectionResult) -And ($logonAttempt -le 10))
{
$LogonAttempt++
#Logging in to Azure...
$connectionResult = Connect-AzAccount `
Start-Sleep -Seconds 30
if($connectionResult)
{
$logonResult = $True
}
}
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint "<CertificateThumbprint>"
#Select the subscription you want to work with
Select-AzSubscription -SubscriptionName '<YourSubscriptionNameGoesHere>'
#Test and get outputs of the subscriptions you granted access.
$subscriptions = Get-AzSubscription
foreach($subscription in $subscriptions)
{
Set-AzContext $subscription
Write-Output $subscription.Name
}
Get-AzVM : The client '<client-id>' with object id '<object-id> 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... +
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
Add-AzureAccount: AADSTS50079: Strong authentication enrollment (proof-up) is required
$SomeVariable = add-pnplistitem ....
if ($SomeVariable.someproperty -eq ....
<cmdlet name>: The term <cmdlet name> is not recognized as the name of a cmdlet, function, script file, or operable program.
Add-AzAccount : Object reference not set to an instance of an object
$AutomationAccountName = "ContosoAutomationAccount"
$RunbookName = "ChildRunbookExample"
$ResourceGroupName = "ContosoRG"
function IsJobTerminalState([string]$Status) {
$TerminalStates = @("Completed", "Failed", "Stopped", "Suspended")
return $Status -in $TerminalStates
}
$StartAzAutomationRunbookParameters = @{
Name = $RunbookName
AutomationAccountName = $AutomationAccountName
ResourceGroupName = $ResourceGroupName
}
$Job = Start-AzAutomationRunbook @StartAzAutomationRunBookParameters
$PollingSeconds = 5
$MaxTimeout = New-TimeSpan -Hours 3 | Select-Object -ExpandProperty TotalSeconds
$WaitTime = 0
while(-NOT (IsJobTerminalState $Job.Status) -and $WaitTime -lt $MaxTimeout) {
Start-Sleep -Seconds $PollingSeconds
$WaitTime += $PollingSeconds
$Job = $Job | Get-AzAutomationJob
}
$Job | Get-AzAutomationJobOutput | Get-AzAutomationJobOutputRecord | Select-Object -ExpandProperty Value
Cannot bind parameter <ParameterName>.
Cannot convert the <ParameterType> value of type Deserialized <ParameterType> to type <ParameterType>.
Exception was thrown - Cannot invoke method. Method invocation is supported only on core types in this language mode.
Connect-AzAccount : Method 'get_SerializationSettings' in type
'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly
'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
does not have an implementation.
At line:16 char:1
+ Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID -Appl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-AzAccount], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.Azure.Commands.Profile.ConnectAzAccountCommand