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
|
$IdentityId = $Identity.Id
$PrincipalId = (Get-AzUserAssignedIdentity -Name $IdentityName -ResourceGroupName $ResourceGroup).PrincipalId
$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