Cloud Manager Environment Variables environment-variables

Standard environment variables can be configured and managed via Cloud Manager. They are provided to the run time environment and can be used in OSGi configurations. Environment variables can be either environment-specific values or environment secrets, based on what is being changed.

Overview overview

Environment variables offer a host of benefits to users of AEM as a Cloud Service:

  • They allow the behavior of your code and application to vary based on context and environment. For example, they can used to enable different configurations on the development environment compared to the production or stage environments to avoid costly mistakes.
  • They only need to be configured and setup once and can be updated and deleted when necessary.
  • Their values can be updated at any point in time and take effect immediately without the need for any code changes or deployments.
  • They can separate code from configuration and remove the need to include sensitive information in version control.
  • They improve the security of the AEM as a Cloud Service application since they live outside of the code.

Typical use cases for using environment variables include:

  • Connecting your AEM application with different external endpoints
  • Using a reference when storing passwords instead of directly in the code base
  • When multiple development environments exist in a program and some configuration differs from one environment to the next

Adding Environment Variables add-variables

NOTE
You must be a member of the Deployment Manager role to add or modify environment variables.
  1. Log into Adobe Cloud Manager at my.cloudmanager.adobe.com.

  2. On the My Programs screen, select the one you want to manage.

  3. Select the Environments tab for the chosen program then select the environment for which you want to create an environment variable in the left navigation panel.

  4. Within the detail of the environment, select the Configuration tab then select Add to open the Environment Configuration dialog.

    • If you are adding an environment variable for the first time, you can see an Add Configuration button in the center of the page. You can use this button or Add to open the Environment Configuration dialog.

    Configuration tab

  5. Enter the variable details.

    • Name
    • Value
    • Service Appplied - Defines for which service (Author/Publish/Preview) the variable applies or if it applies to all services
    • Type - Defines if the variable is normal variable or a secret

    Adding a variable

  6. After you enter your new variable, you must select Add in the last column of the row containing the new variable.

    • You can enter multiple variables at once by entering a new line and selecting Add.

    Save variables

  7. Select Save to persist your variables.

An indicator with the status Updating is shown at the top of the table and next to the newly added variable to indicate that the environment is being updated with the configuration. After completion, the new environment variable is visible in the table.

Updating variables

TIP
If you want to add multiple variables, it is recommended to add the first variable, then use the Add button in the Environment Configuration dialog to add the additional variables. This way you can add them with one update to the environment.

Updating Environment Variables update-variables

After you have created environment variables, you can update them using the Add/Update button to launch the Environment Configuration dialog.

  1. Log into Adobe Cloud Manager at my.cloudmanager.adobe.com.

  2. Cloud Manager lists the various programs available. Select the one you want to manage.

  3. Select the Environments tab for the chosen program then select the environment for which you want to create an environment variable in the left navigation panel.

  4. Within the detail of the environment, select the Configuration tab then select Add/update in the top right to open the Environment Configuration dialog.

    Add/Update button for variables

  5. Using the ellipsis button in the last column of the row of the variable you want to modify, select Edit or Delete.

    Edit or delete variable

  6. Edit the environment variable as necessary.

    • When editing, the ellipsis button will change to options to revert back to the original value or confirm your change.
    • When editing secrets, the values can only be updated, not viewed.

    Edit variable

  7. After you have made the required configuration changes, select Save.

As when adding variables, an indicator with the status Updating is shown at the top of the table and next to the newly updated variable(s) to indicate that the environment is being updated with the configuration. After completion, the updated environment variables are visible in the table.

TIP
If you want to update multiple variables, it is recommended to use the Environment Configuration dialog to update all necessary variables at once before tapping or clicking Save. This way you can add them with one update to the environment.

Using Environment Variables using

Environment variables can make your pom.xml configurations more secure and flexible. For example, passwords needn’t be hard coded and your configuration can adapt based on the values in environment variables.

You can access environment variables and secrets via XML as follows.

  • ${env.VARIABLE_NAME}

See the document Setting Up Project for an example of how to use both types of variables in a pom.xml file.

See the official Maven documentation for more details.

Environment Variable Availability availability

Environment variables can be used in several places.

Author, Preview, and Publish author-preview-publish

Both regular environment variables and secrets can be used in the authoring, preview, and publishing environments.

Dispatcher dispatcher

Only regular environment variables can be used with the dispatcher. Secrets cannot be used.

However environment variables cannot be used in IfDefine directives.

TIP
You should validate your use of environment variables with the dispatcher locally before deploying.

OSGi Configurations osgi

Both regular environment variables and secrets can be used in OSGi configurations.

Pipeline Variables pipeline

In addition to environment variables, there are also pipeline variables, which are exposed during the build phase. Learn more about pipeline variables here.

recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab