Create Pull Request
| Date | Scan | Status | Result |
|---|---|---|---|
| 2025-07-12 23:44 | #41 | cancelled |
Biased
|
| 2025-07-12 00:58 | #8 | cancelled |
Clean
|
| 2025-07-10 05:06 | #7 | processing |
Clean
|
$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
$IdentityId = (Get-AzUserAssignedIdentity -Name $IdentityName -ResourceGroupName $ResourceGroupName).Id $PrincipalId = (Get-AzUserAssignedIdentity -Name $IdentityName -ResourceGroupName $ResourceGroupName).PrincipalId
$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
$RegistryId = (Get-AzContainerRegistry -ResourceGroupName <RegistryResourceGroup> -Name $RegistryName).Id
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
Remove-AzResourceGroup -Name $ResourceGroupName -Force
$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
$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
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'