---
title: Service Discovery
description: The App Configuration keys that deployed Forge services read to find other services, who publishes each key, and where the endpoints for services outside Forge are documented.
tags:
  - service-discovery
---

# Service Discovery

Deployed Forge applications find other services by reading `services:*` keys from the shared Azure App Configuration store. Two publishers write to that store: Forge's `api` module registers each deployed API, and the Cloud Foundations shared-services stack registers services outside Forge, such as on-premise systems and third-party SaaS. This page is the lookup for the key shapes. For how a caller uses them, see [Downstream API calls: service discovery from local to deployed](../build/apis/calling-apis.md#service-discovery-local-to-deployed).

---

## 🔑 Key shape

Every key follows `services:{name}:{setting}` and carries an environment label in lowercase, for example `test`, `platformdev`, `qa`, `uat`, or `prod`. `{name}` is the logical service name the caller uses in its HTTP client base address.

| Publisher | `{name}` | Keys | Value |
| --- | --- | --- | --- |
| Forge `api` module | The API's project ID | `services:{projectId}:https`, `services:{projectId}:path` | `https` is the Front Door base URL, including the scheme. `path` is the APIM API path. |
| Forge `api` module (optional) | The API's project ID | `services:{projectId}:ext:authserver`, `services:{projectId}:corp:authserver`, and the matching `authserveraudience` keys | The authorization server URL or audience: Okta for the external tenant (`ext`), Entra ID for the corporate tenant (`corp`). |
| Cloud Foundations shared services | A service outside Forge, such as `policycenter`, `api`, or `workday` | `services:{name}:https` | `host[:port]` with no scheme. |

The Forge-published keys are created only when `enable_service_discovery` is `true`. The [`saif-api-service` module](terraform/saif-api-service/index.md) always enables it. The auth server keys are written only when the module's `service_discovery_config` enables them. [`service_discovery.tf`](https://github.com/saif-corp/forge/blob/main/src/terraform/saif-resources/modules/api/service_discovery.tf) is the source for the Forge keys.

The Front Door base URL in `https` is the same value as `context.naming.internal_base_url` or `external_base_url`; see [Service URLs](service-urls.md#environment-base-urls).

---

## 📥 How applications read the keys

`AddAzureDefaults()` loads `services:*` from App Configuration into application configuration, and `AddServiceDefaults()` registers configuration-backed service discovery for HTTP clients. A caller that keeps the logical name in its base address resolves the deployed endpoint without code changes. Locally, Aspire supplies the same logical names from AppHost references; see [Service discovery](https://aspire.dev/fundamentals/service-discovery/) in the Aspire documentation. If no key exists for the name, resolution falls back to DNS for the logical name and the call fails with `Name or service not known`. See [Downstream API call fails: Name or service not known](../troubleshoot/service-discovery-name-or-service-not-known.md).

---

## 🏢 Services outside Forge

Cloud Foundations owns the keys for services that Forge does not deploy, including on-premise systems and third-party SaaS, and the host and port each environment maps to. The source of truth is `infra/shared-services/services.yml` in the `cloud-foundations` repository. Use its reference for the list of services and their per-environment endpoints rather than copying them here: [Service Discovery Reference](https://docs.saif.com/cloud-foundations/reference/service-discovery/).

To add or change an endpoint for a service outside Forge, request the change in [saif-corp/cloud-foundations](https://github.com/saif-corp/cloud-foundations/issues). A Forge application cannot override these keys.

---

## 📚 Related

- [Downstream API calls: service discovery from local to deployed](../build/apis/calling-apis.md#service-discovery-local-to-deployed)
- [Golden Path: Service Discovery](architecture/golden-path.md#service-discovery)
- [Service URLs](service-urls.md)
- [Service Discovery Reference](https://docs.saif.com/cloud-foundations/reference/service-discovery/) in the Cloud Foundations documentation
- [Service discovery](https://aspire.dev/fundamentals/service-discovery/) in the Aspire documentation
