api-version: 2024-02-02-preview
location: {{ .Env.AZURE_LOCATION }}
identity:
  type: UserAssigned
  userAssignedIdentities:
    ? "{{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}"
    : {}
properties:
  environmentId: {{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_ID }}
  configuration:
    activeRevisionsMode: single
    runtime:
      dotnet:
        autoConfigureDataProtection: true
    ingress:
      external: true
      targetPort: 8080
      transport: http
      allowInsecure: false
    registries:
      - server: {{ .Env.AZURE_CONTAINER_REGISTRY_ENDPOINT }}
        identity: {{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}
  template:
    volumes:
      - name: idp-bm0
        storageType: AzureFile
        storageName: {{ .Env.SERVICE_IDP_VOLUME_BM0_NAME }} 
    containers:
      - image: {{ .Image }}
        name: idp
        args:
          - start
          - --import-realm
        env:
          - name: AZURE_CLIENT_ID
            value: {{ .Env.MANAGED_IDENTITY_CLIENT_ID }}
          - name: KEYCLOAK_ADMIN
            value: admin
          - name: KEYCLOAK_ADMIN_PASSWORD
            value: admin
          - name: WEBAPP_CLIENT_SECRET
            value: some_secret
        volumeMounts:
          - volumeName: idp-bm0
            mountPath: /opt/keycloak/data/import
    scale:
      minReplicas: 1
tags:
  azd-service-name: idp
  aspire-resource-name: idp
