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:
⚠️
windows_first
⚠️
powershell_heavy
Summary:
The documentation provides both Azure CLI (Bash) and Azure PowerShell examples throughout, but there is a consistent pattern of presenting PowerShell (a Windows-centric tool) alongside or even before Bash/CLI in many sections. The prerequisites and setup instructions often mention PowerShell explicitly and sometimes in more detail than Bash, and the inclusion of PowerShell tabs and instructions may suggest a slight Windows bias. However, Linux users are not excluded, as Bash/CLI examples are present for all major steps. There are no exclusive Windows-only tools or missing Linux examples, but the parity in depth and order could be improved.
Recommendations:
- Ensure that Bash/Azure CLI examples are always presented first, as CLI is cross-platform and more common for Linux users.
- Where possible, provide additional context or troubleshooting tips specifically for Linux environments (e.g., file permissions, environment variable syntax differences).
- Avoid giving more detailed or advanced PowerShell examples than Bash/CLI unless there is a technical reason.
- Explicitly state that all CLI examples work on Linux, macOS, and Windows, and clarify any OS-specific requirements.
- Consider adding a short section or note for Linux users highlighting any differences or best practices.
Create pull request
Flagged Code Snippets
$ResourceGroupName = '<RESOURCE_GROUP_NAME>'
$Location = '<LOCATION>'
$ContainerAppsEnvironment = '<ENVIRONMENT_NAME>'
$RegistryName = '<REGISTRY_NAME>'
$ContainerAppName = '<CONTAINERAPP_NAME>'
$ImageName = '<IMAGE_NAME>'
$WorkspaceArgs = @{
Name = 'myworkspace'
ResourceGroupName = $ResourceGroupName
Location = $Location
PublicNetworkAccessForIngestion = 'Enabled'
PublicNetworkAccessForQuery = 'Enabled'
}
New-AzOperationalInsightsWorkspace @WorkspaceArgs
$WorkspaceId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $ResourceGroupName -Name $WorkspaceArgs.Name).CustomerId
$WorkspaceSharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $ResourceGroupName -Name $WorkspaceArgs.Name).PrimarySharedKey
$EnvArgs = @{
EnvName = $ContainerAppsEnvironment
ResourceGroupName = $ResourceGroupName
Location = $Location
AppLogConfigurationDestination = 'log-analytics'
LogAnalyticConfigurationCustomerId = $WorkspaceId
LogAnalyticConfigurationSharedKey = $WorkspaceSharedKey
}
New-AzContainerAppManagedEnv @EnvArgs
$IdentityName = '<YOUR_IDENTITY_NAME>'
New-AzUserAssignedIdentity -Name $IdentityName -ResourceGroupName $ResourceGroupName -Location $Location
$IdentityId = (Get-AzUserAssignedIdentity -Name $IdentityName -ResourceGroupName $ResourceGroupName).Id
$PrincipalId = (Get-AzUserAssignedIdentity -Name $IdentityName -ResourceGroupName $ResourceGroupName).PrincipalId
New-AzRoleAssignment -ObjectId $PrincipalId -Scope $RegistryId -RoleDefinitionName acrpull
$CredentialArgs = @{
Server = $RegistryName + '.azurecr.io'
Identity = $IdentityId
}
$CredentialObject = New-AzContainerAppRegistryCredentialObject @CredentialArgs
$ImageParams = @{
Name = 'my-container-app'
Image = $RegistryName + '.azurecr.io/' + $ImageName + ':latest'
}
$TemplateObj = New-AzContainerAppTemplateObject @ImageParams
$EnvId = (Get-AzContainerAppManagedEnv -EnvName $ContainerAppsEnvironment -ResourceGroupName $ResourceGroupName).Id
$AppArgs = @{
Name = 'my-container-app'
Location = $Location
ResourceGroupName = $ResourceGroupName
ManagedEnvironmentId = $EnvId
ConfigurationRegistry = $CredentialObject
UserAssignedIdentity = @($IdentityId)
TemplateContainer = $TemplateObj
IngressTargetPort = 80
IngressExternal = $true
}
New-AzContainerApp @AppArgs
$ImageParams = @{
Name = "my-container-app"
Image = "mcr.microsoft.com/k8se/quickstart:latest"
}
$TemplateObj = New-AzContainerAppTemplateObject @ImageParams
$EnvId = (Get-AzContainerAppManagedEnv -EnvName $ContainerAppsEnvironment -ResourceGroupName $ResourceGroupName).Id
$AppArgs = @{
Name = "my-container-app"
Location = $Location
ResourceGroupName = $ResourceGroupName
ManagedEnvironmentId = $EnvId
IdentityType = "SystemAssigned"
TemplateContainer = $TemplateObj
IngressTargetPort = 80
IngressExternal = $true
}
New-AzContainerApp @AppArgs
Remove-AzResourceGroup -Name $ResourceGroupName -Force
$ResourceGroupName = '<RESOURCE_GROUP_NAME>'
$Location = '<LOCATION>'
$RegistryName = '<REGISTRY_NAME>'
$ImageName = '<IMAGE_NAME>'
$ImageTag = '<IMAGE_TAG>'
$BicepTemplate = '<BICEP_TEMPLATE>'
$ContainerAppsEnvironment = '<ENVIRONMENT_NAME>'
$ContainerName = '<CONTAINER_NAME>'
$ContainerAppName = '<CONTAINERAPP_NAME>'
$UserAssignedIdentityName = '<USER_ASSIGNED_IDENTITY_NAME>'
$LogAnalyticsWorkspaceName = '<LOG_ANALYTICS_WORKSPACE_NAME>'
$AppInsightsName = '<LOG_ANALYTICS_WORKSPACE_NAME>'
$AcrPullDefinitionId = '7f951dda-4ed3-4680-a7ca-43fe172d538d'
$params = @{
environmentName = $ContainerAppsEnvironment
logAnalyticsWorkspaceName = $LogAnalyticsWorkspaceName
appInsightsName = $AppInsightsName
containerAppName = $ContainerAppName
azureContainerRegistry = $RegistryName
azureContainerRegistryImage = $ImageName
azureContainerRegistryImageTag = $ImageTag
azureContainerName = $ContainerName
acrPullDefinitionId = $AcrPullDefinitionId
userAssignedIdentityName = $UserAssignedIdentityName
location = $Location
}
New-AzResourceGroupDeployment `
-ResourceGroupName $ResourceGroupName `
-TemplateParameterObject $params `
-TemplateFile $BicepTemplate `
-SkipTemplateParameterPrompt
New-AzResourceGroup -Location $Location -Name $ResourceGroupName
$RegistryId = (Get-AzContainerRegistry -ResourceGroupName <RegistryResourceGroup> -Name $RegistryName).Id
Remove-AzResourceGroup -Name $ResourceGroupName -Force
$CredentialArgs = @{
Server = $RegistryName + '.azurecr.io'
Identity = 'system'
}
$CredentialObject = New-AzContainerAppRegistryCredentialObject @CredentialArgs
$ImageParams = @{
Name = 'my-container-app'
Image = $RegistryName + ".azurecr.io/" + $ImageName + ":latest"
}
$TemplateObj = New-AzContainerAppTemplateObject @ImageParams
$AppArgs = @{
Name = 'my-container-app'
Location = $Location
ResourceGroupName = $ResourceGroupName
ConfigurationRegistry = $CredentialObject
IdentityType = 'SystemAssigned'
TemplateContainer = $TemplateObj
IngressTargetPort = 80
IngressExternal = $true
}
Update-AzContainerApp @AppArgs