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
⚠️
windows_first
Summary:
The documentation provides both Bash and PowerShell examples for most commands, but the PowerShell sections are significantly more detailed, often using Az PowerShell modules rather than cross-platform Azure CLI. In some cases, PowerShell-specific tools (like Connect-AzContainerRegistry, New-AzUserAssignedIdentity, New-AzContainerApp) are used, which are primarily Windows-centric. The PowerShell examples are often more verbose and sometimes appear before or in more detail than their Bash equivalents. There is little to no mention of Linux-specific patterns, shells, or troubleshooting, and the documentation assumes familiarity with PowerShell and its object-oriented scripting, which is less common on Linux/macOS.
Recommendations:
- Prioritize Azure CLI (az) examples, which are cross-platform, and only provide PowerShell-specific examples as secondary or in advanced sections.
- Ensure that Bash examples are as detailed as PowerShell ones, including variable setup, error handling, and output parsing.
- Avoid using PowerShell-specific Az module commands (e.g., New-AzContainerApp) as primary examples; instead, use Azure CLI equivalents where possible.
- Explicitly mention that Bash examples work on Linux/macOS/WSL and provide troubleshooting tips for common Linux environments.
- Where PowerShell is used, clarify that it is available cross-platform (PowerShell Core), but avoid assuming Windows as the default environment.
- Include Linux/macOS-specific notes or callouts where behaviors or prerequisites differ (e.g., Docker Desktop installation, file permissions, environment variable syntax).
Create pull request
Flagged Code Snippets
$acr = New-AzContainerRegistry `
-ResourceGroupName $ResourceGroup `
-Location $Location `
-Name $ACRName `
-Sku Basic
$acr.AzureAdAuthenticationAsArmPolicyStatus
Update-AzContainerRegistry `
-ResourceGroupName $acr.ResourceGroupName `
-Name $acr.Name `
-AzureAdAuthenticationAsArmPolicyStatus enabled
$IdentityName="<YOUR_IDENTITY_NAME>"
$Identity = New-AzUserAssignedIdentity -ResourceGroupName $ResourceGroup -Name $IdentityName
$RegistryId = (Get-AzContainerRegistry -ResourceGroupName $ResourceGroup -Name $ACRName).Id
New-AzRoleAssignment -ObjectId $PrincipalId -Scope $RegistryId -RoleDefinitionName acrpull
Connect-AzContainerRegistry -Name $ACRName
$WorkspaceArgs = @{
Name = 'my-album-workspace'
ResourceGroupName = $ResourceGroup
Location = $Location
PublicNetworkAccessForIngestion = 'Enabled'
PublicNetworkAccessForQuery = 'Enabled'
}
New-AzOperationalInsightsWorkspace @WorkspaceArgs
$WorkspaceId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $ResourceGroup -Name $WorkspaceArgs.Name).CustomerId
$WorkspaceSharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $ResourceGroup -Name $WorkspaceArgs.Name).PrimarySharedKey
$EnvArgs = @{
EnvName = $Environment
ResourceGroupName = $ResourceGroup
Location = $Location
AppLogConfigurationDestination = 'log-analytics'
LogAnalyticConfigurationCustomerId = $WorkspaceId
LogAnalyticConfigurationSharedKey = $WorkspaceSharedKey
}
New-AzContainerAppManagedEnv @EnvArgs
$ImageParams = @{
Name = $APIName
Image = $ACRName + '.azurecr.io/' + $APIName + ':latest'
}
$TemplateObj = New-AzContainerAppTemplateObject @ImageParams
$RegistryArgs = @{
Server = $ACRName + '.azurecr.io'
Identity = $IdentityId
}
$RegistryObj = New-AzContainerAppRegistryCredentialObject @RegistryArgs
$EnvId = (Get-AzContainerAppManagedEnv -EnvName $Environment -ResourceGroup $ResourceGroup).Id
$AppConfig = @{
IngressTargetPort = 8080
IngressExternal = $true
Registry = $RegistryObj
}
$AppConfigObj = New-AzContainerAppConfigurationObject @AppConfig
$AppArgs = @{
Name = $APIName
Location = $Location
ResourceGroupName = $ResourceGroup
ManagedEnvironmentId = $EnvId
TemplateContainer = $TemplateObj
Configuration = $AppConfigObj
UserAssignedIdentity = @($IdentityId)
}
$MyApp = New-AzContainerApp @AppArgs
# Show the app's fully qualified domain name (FQDN).
$MyApp.LatestRevisionFqdn
Remove-AzResourceGroup -Name $ResourceGroup -Force
$IdentityId = $Identity.Id
$PrincipalId = (Get-AzUserAssignedIdentity -Name $IdentityName -ResourceGroupName $ResourceGroup).PrincipalId