I get this error " InternalServerError" and i cant figure out what is happening..
I have a Main.bicep and some Modules, LogAnalytics, ContainerEnviorment, ContainerApp...
What can it be?
Main
param location string = resourceGroup().location
param envName string = 'MyProject'
param containerImage string
param containerPort int
param registry string
param registryUsername string
@secure()
param registryPassword string
//LogAnalytics
module LogAnalytics 'LogAnalytics.bicep' = {
name: 'log-analytics-workspace'
params: {
location: location
name: 'LogAnalytics-${envName}'
}
}
//Container Environment
module containerAppEnvironment 'ContainerEnvironment.bicep' = {
name: 'container-app-environment'
params: {
name: envName
location: location
LogAnalyticsClientId:LogAnalytics.outputs.clientId
LogAnalyticsClientSecret: LogAnalytics.outputs.clientSecret
}
}
// ContainerApp
module containerApp 'containerapp.bicep' = {
name: 'sample'
params: {
name: 'sample-app'
location: location
containerAppEnvironmentId: containerAppEnvironment.outputs.id
containerImage: containerImage
containerPort: containerPort
envVars: [
{
name: 'ASPNETCORE_ENVIRONMENT'
value: 'Production'
}
]
useExternalIngress: true
registry: registry
registryUsername: registryUsername
registryPassword: registryPassword
}
}
output fqdn string = containerApp.outputs.fqdn
Containerapp
// general Azure Container App settings
param location string
param name string
param containerAppEnvironmentId string
// Container Image ref
param containerImage string = 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
// Networking
param useExternalIngress bool = true
param containerPort int = 80
param allowInsecure bool = false
param registry string
param registryUsername string
@secure()
param registryPassword string
param envVars array = []
resource containerApp 'Microsoft.Web/containerApps@2021-03-01' = {
name: name
kind: 'containerapp'
location: location
properties: {
kubeEnvironmentId: containerAppEnvironmentId
configuration: {
secrets: [
{
name: 'container-registry-password'
value: registryPassword
}
]
registries: [
{
server: registry
username: registryUsername
passwordSecretRef: 'container-registry-password'
}
]
ingress: {
external: useExternalIngress
targetPort: containerPort
allowInsecure: allowInsecure
}
}
template: {
containers: [
{
image: containerImage
name: name
env: envVars
}
]
scale: {
minReplicas: 1
maxReplicas: 3
}
}
}
}
output fqdn string = containerApp.properties.configuration.ingress.fqdn
ContainerEnvironment
param name string
param location string
param LogAnalyticsClientId string
param LogAnalyticsClientSecret string
resource ContainerAppEnv 'Microsoft.Web/kubeEnvironments@2021-02-01' = {
name: name
location: location
properties: {
type: 'managed' //antes - "type"
internalLoadBalancerEnabled: false
appLogsConfiguration: {
destination: 'log-analytics'
logAnalyticsConfiguration: {
customerId: LogAnalyticsClientId
sharedKey: LogAnalyticsClientSecret
}
}
}
}
output id string = ContainerAppEnv.id
LogAnalytics
param location string
param name string
resource LogAnalytics 'Microsoft.OperationalInsights/workspaces@2020-03-01-preview' = {
name: name
location: location
properties: any({
retentionInDays: 30
features: {
searchVersion: 1
}
sku: {
name: 'PerGB2018'
}
})
}
output clientId string = LogAnalytics.properties.customerId
output clientSecret string = LogAnalytics.listKeys().primarySharedKey
So it might be the region? The registry? Hope someone can give me a hand with this.
Thanks!!!