---
title: "Application not found: no applications found matching filter on pre_authorized"
description: The auth_corp deployment fails because an app listed in authorized_apps has no Entra app registration in the target environment yet. Deploy the upstream app to that environment first, then re-run the failed stage.
id: SAIFTRBL0019
tags:
  - troubleshooting
  - terraform
  - authentication
---

# Application not found: no applications found matching filter on pre_authorized

If the `auth_corp` deployment fails with `Application not found` on `data.azuread_application.pre_authorized`, an app listed under `authorized_apps` in `infra/auth/corp/config.yml` has no Entra app registration in that environment yet. Deploy the upstream app to the same environment first, then re-run the failed stage.

---

## 🚨 Symptom

The `🚀 Terraform Apply` step of the `Deploy auth_corp (terraform)` job fails during the plan:

```text
Error: Application not found

  with module.application_permissions.module.permissions.data.azuread_application.pre_authorized["it-api-proc-invites"],
  on .terraform/modules/application_permissions.permissions/modules/application_permissions/main.tf line 102, in data "azuread_application" "pre_authorized":
 102: data "azuread_application" "pre_authorized" {

no applications found matching filter: "displayName eq
'it-api-proc-invites-prod'"
```

The key in `pre_authorized["..."]` is the upstream app's `project_id`, and the display name in the filter is `<project_id>-<environment>`.

Check the address before you use this article. The same `Application not found` text on `data.azuread_application.application[0]` means the API's own app registration was read before it was created, which is a different problem fixed in the templates by [#323](https://github.com/saif-corp/forge/pull/323).

This error often appears next to `No group found matching specified filter` when a release depends on several new pieces at once. That error has its own article: [No group found matching specified filter for a business role](application-permissions-business-role-group-not-found.md).

---

## 📌 Applies to

APIs that pre-authorize other apps through the Forge `application-permissions` module, meaning `infra/auth/corp/config.yml` has an `authorized_apps` list. The module looks up each entry by display name, built from the entry's `project_id` and the environment short name, such as `test`, `qa`, `uat`, or `prod`.

It typically appears the first time an API reaches an environment before the app it authorizes, for example when a new system API and a new process API ship in the same release and the system API deploys first.

Do not use this fix if the upstream app is already deployed to that environment. In that case, compare the `project_id` in `authorized_apps` with the upstream app's real project ID, since a typo produces the same error.

### Prerequisites and safety

- The [SAIF CLI](../learn/install-saif-cli.md), signed in with an account that can read Entra ID app registrations.
- Permission to run and approve the upstream app's pipeline in the target environment.
- The failed apply did not change anything in Entra for the `auth_corp` deployment, because the error happens during the plan. Earlier jobs in the same stage, such as `api_infra`, might already have deployed.

---

## ✅ Fix

1. Confirm the upstream app registration is missing in the target environment. Search by the upstream app's `project_id`, which lists the registration for every environment it has reached:

    ```powershell
    saif app search --name '<project_id>'
    ```

    If `<project_id>-<environment>` from the error is not in the list, the upstream app has not deployed to that environment. For example, this list has Test, QA, and UAT but no `-prod` registration:

    ```text
    │ it-api-proc-invites-qa   │ c236aeb6-... │ api://it-api-proc-invites-qa   │
    │ it-api-proc-invites-test │ f97e101e-... │ api://it-api-proc-invites-test │
    │ it-api-proc-invites-uat  │ 6b799711-... │ api://it-api-proc-invites-uat  │
    ```

2. Deploy the upstream app to that environment. Approve its pending stage if it already has a run waiting, or queue a run of its pipeline with `saif pipeline run`.
3. After the upstream app is deployed, re-run the failed stage of the API that reported the error. Only re-run the stage if the run was queued recently. A run queued before a pipeline-templates change keeps the old templates, which can fail differently. See [Terraform Init fails with 401 Unauthorized from tf.pulumi.com](terraform-init-tf-pulumi-com-401-unauthorized.md).

If the upstream app is a custom Entra registration for a third-party integration rather than a Forge-deployed app, create one registration per environment named `<project_id>-<environment>`, as described in [Naming custom Entra apps for third-party integrations](../build/identity/configuration/app-permissions.md#naming-custom-entra-apps-for-third-party-integrations).

If the upstream app should not be in this environment yet, remove its entry from `authorized_apps`, deploy, and add it back once the upstream app ships.

---

## 🔬 Verify

Running `saif app search --name '<project_id>'` again lists the registration for the target environment:

```text
│ it-api-proc-invites-prod │ <application-id> │ api://it-api-proc-invites-prod │
```

The re-run `Deploy auth_corp (terraform)` job completes, and the plan refreshes `data.azuread_application.pre_authorized["<project_id>"]` without an error.

---

## 🧠 Cause

The `application-permissions` module resolves each `authorized_apps` entry with a `data "azuread_application"` lookup, using the display name `<project_id>-<environment_short_name>`. A data source must find exactly the object it asks for, so Terraform stops the plan when the upstream app registration does not exist yet. Each app's own pipeline creates its registration, and Forge does not order pipelines across repositories, so the release has to deploy the upstream app before any API that pre-authorizes it.

---

## 📚 Related

- [App Permissions](../build/identity/configuration/app-permissions.md)
- [Deployment Workflow](../build/identity/configuration/deployment-workflow.md)
- [No group found matching specified filter for a business role](application-permissions-business-role-group-not-found.md)
- Source: Azure DevOps build 213857 (`it-api-sys-invites-api`), production deploy on 2026-10-15
