# Securely pass credentials to app functions?

**URL:** <https://community.dynatrace.com/t/securely-pass-credentials-to-app-functions/56351>\
**Category:** Developer Q&A Forum\
**Tags:** app-functions\
**Created:** [July 2, 2026, 12:45pm UTC](https://community.dynatrace.com/t/securely-pass-credentials-to-app-functions/56351 "2026-07-02T12:45:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimitris\_G-K](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@Dimitris\_G-K](https://community.dynatrace.com/u/Dimitris_G-K)\
**Post date:** [July 2, 2026, 12:45pm UTC](https://community.dynatrace.com/t/securely-pass-credentials-to-app-functions/56351/1 "2026-07-02T12:45:02Z")

</div>

I’m building a Dynatrace app that includes a backend function which calls the Account Management API to fetch the DPS rate card. The function needs three credentials: `CLIENT_ID`, `CLIENT_SECRET`, and `ACCOUNT_URN`.&nbsp; I have tried with .env file (`dt-app` does not load it at runtime, the variables come back empty ), also with&nbsp;&nbsp;adding a `function.env`&nbsp; block to `app.config.json` (`CliOptions`reject it) and lastly the one that is working, hardcoding the values directly in the function file and adding it to `.gitignore`of course.

Is there an officially supported way to inject environment variables into Dynatrace app functions at deploy time, without hardcoding them in the source code?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [July 3, 2026, 12:03am UTC](https://community.dynatrace.com/t/securely-pass-credentials-to-app-functions/56351/2 "2026-07-03T00:03:44Z")

</div>

Hello&nbsp;[@Dimitris\_G-K](https://community.dynatrace.com/user/103979)&nbsp;you could [define a settings schema.](https://developer.dynatrace.com/develop/guides/data/store-app-settings/#define-a-settings-schema)

Look for [Use Secrets](https://developer.dynatrace.com/develop/guides/data/store-app-settings/#define-a-settings-schema) section.

```markup
{
  "dynatrace": "1",
  "schemaId": "my-example-secrets",
  "version": "1.0.0",
  "displayName": "Allows you to configure connections to a fictional messaging service",
  "description": "",
  "multiObject": true,
  "maxObjects": 10,
  "maturity": "GENERAL_AVAILABILITY",
  "summaryPattern": "Messaging Service {url}",
  "ordered": false,
  "properties": {
    "isEnabled": {
      "displayName": "Enabled",
      "description": "Enable the integration of the messaging service",
      "type": "boolean",
      "default": false,
      "nullable": false
    },
    "description": {
      "displayName": "Description of the connection",
      "type": "text",
      "default": "",
      "nullable": false
    },
    "url": {
      "displayName": "URL",
      "description": "The URL of the messaging service",
      "type": "text",
      "default": "",
      "nullable": false,
      "forceSecretResubmission": true,
      "constraints": [
        {
          "type": "PATTERN",
          "customMessage": "The URL must be secure (https://) and must not contain a trailing slash",
          "pattern": "^https://.*[^/]$"
        }
      ]
    },
    "token": {
      "displayName": "Token",
      "description": "A secret token",
      "type": "secret",
      "default": "",
      "nullable": false
    }
  },
  "constraints": [
    {
      "type": "SECRET_RESUBMISSION",
      "customMessage": "For security reasons, please re-enter the token before saving the settings.",
      "checkAllProperties": false
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Dimitris\_G-K](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@Dimitris\_G-K](https://community.dynatrace.com/u/Dimitris_G-K)\
**Post date:** [July 3, 2026, 8:01am UTC](https://community.dynatrace.com/t/securely-pass-credentials-to-app-functions/56351/3 "2026-07-03T08:01:44Z")

</div>

Thank you very much, I’ll check it out!
