---
id: SAIFTRBL0016
title: "Subscription key missing in EnvironmentBoss for an environment"
description: A legacy .NET client's GetSecureSetting call for the subscription key fails because Crypto/Environment Service entries only exist for environments the Experience API has actually deployed to in Azure.
tags:
  - troubleshooting
  - environment-service
---

# Subscription key missing in EnvironmentBoss for an environment

If `IEnvironmentClient.GetSecureSetting` can't retrieve `primary_subscription_key` for the on-prem track your legacy app is pointed at, deploy the Experience API to the Azure environment that maps to that track — the key is only registered once a deploy actually runs there. Don't file a request to manually add the key to Crypto/EnvironmentBoss for that track.

---

## 🚨 Symptom

A legacy on-prem .NET client (for example an app with `web.config` pointed at `enttest1`) fails at the call site that retrieves the subscription key:

```csharp
_environmentClient.GetSecureSetting(
    "primary_subscription_key",
    "your-project-id",  // setting group = projectId
    hash);
```

The call fails or returns nothing, and the client can't send `Ocp-Apim-Subscription-Key`, even though the [Subscription Key Authentication](../build/identity/configuration/subscription-key-auth.md) pipeline ran successfully and you can see the key in EnvironmentBoss for *some* environment.

To confirm this is the issue and not a different Environment Service error, search EnvironmentBoss with a URL of this shape, swapping `group` for your `projectId`:

```text
https://itapp.saif.com/environmentboss/settings/search?searchterm=group%3A<your-project-id>%20key%3Aprimary_subscription_key&activeoption=0&secureoption=0&pagenumber=1&sortoption=0
```

If the result shows `primary_subscription_key` for one track (for example `enttest1`) but not the track your on-prem app is configured for (for example `np13`), that's this issue, not a credentials or configuration typo.

---

## 📌 Applies to

Any Experience API using `subscription_key` auth with `cryptoRegistration.enabled: true`, called by a legacy on-prem .NET client via `IEnvironmentClient`/`ISystemHashService`. Applies whenever the on-prem track you're testing against maps to an Azure environment the API has never been deployed to. Does not apply if the key is missing from *every* track — that points at a pipeline or variable-group problem instead (see the [Crypto Registration Failures](../build/identity/configuration/subscription-key-auth.md#troubleshooting) table).

### Prerequisites and safety

- You need read access to [EnvironmentBoss](https://itapp.saif.com/environmentboss) to run the search above, and pipeline permissions to deploy the Experience API to the target Azure environment.
- This fix only involves deploying your own API through its normal pipeline — it does not change shared infrastructure.

!!! warning "Don't request manual Crypto/EnvironmentBoss provisioning"
    Don't manually add the key for a track in Crypto/Environment Service, and don't submit an Architecture ServiceNow request to do it for you. Either creates a one-off entry that drifts from the centrally owned track mapping (see [Cause](#cause)).

---

## ✅ Fix

1. Find the Azure environment that maps to the on-prem track you need in the track mapping under [Subscription Key Authentication, Step 4](../build/identity/configuration/subscription-key-auth.md#step-4-deploy).
2. Make sure your variable group has `[ENV]primary_key`/`[ENV]secondary_key` entries for that Azure environment stage.
3. Run the deploy pipeline for that stage (for example, deploy to `qa` to populate `np13`). The pipeline's `register-crypto-keys` activity creates the Crypto system/cipher and the Environment Service setting for that track automatically after a successful `terraform apply`.

If you need a mapping to a track that doesn't correspond to any existing Azure environment at all, that's a mapping gap in `cloud-foundations`, not something to work around per-application — raise it there instead of asking for a one-off Crypto entry.

---

## 🔬 Verify

Re-run the EnvironmentBoss search from [Symptom](#symptom) and confirm `primary_subscription_key` now appears for the target track.

Then, point `web.config` at that track and call `GetSecureSetting` — it should return the key value instead of failing.

If the setting still doesn't appear after a successful deploy, check the deploy pipeline's `register-crypto-keys` activity log for errors rather than retrying the on-prem call.

---

## 🧠 Cause

Crypto/Environment Service entries aren't provisioned ahead of time for every track — they're created per Azure environment, post-`apply`, by the `register-crypto-keys` activity in `pipeline-templates` (see [Related](#related)), which reads the keys the deploy job already has from the variable group and registers them against the track mapped to that Azure environment. An application only gets a Crypto/Environment Service entry for a track once it has actually been deployed to the Azure environment that maps to it.

The azure-to-on-prem track mapping itself is centrally owned in `cloud-foundations` (see [Related](#related)), not per-application. Manually adding a key in Crypto/EnvironmentBoss for a track your app hasn't been deployed to bypasses this pipeline step and creates an entry that isn't reflected in that source of truth.

---

## 📚 Related

- [Subscription Key Authentication](../build/identity/configuration/subscription-key-auth.md) — full setup guide, including the pipeline environment-to-track table and `cryptoRegistration` parameters
- [`cloud-foundations` database mappings](https://github.com/saif-corp/cloud-foundations/blob/main/infra/shared-services/oracle_db.yml) and [services mappings](https://github.com/saif-corp/cloud-foundations/blob/main/infra/shared-services/services.yml) — source of truth for azure-to-on-prem environment mappings
- [`register-crypto-keys` activity in `pipeline-templates`](https://dev.azure.com/SAIFCorporation/SAIF/_git/pipeline-templates?path=/v2/deployments/onprem/activities/register-crypto-keys.yml&version=GBreleases/v3) — the pipeline step that registers the keys per track after `terraform apply`
