Using Environment Variables for Credentials

You can use credentials as environment variables in scripts to execute workflow steps. The credentials are previously set, then retrieved and executed in the context of a script.

To make the credentials available to reference as environment variables, you must first enable the required system properties. For more information about the required system properties, see the credentials listed below.

The following credentials are available to use as environment variables:

Cloud account credentials

To target cloud accounts in workflow steps without creating additional credentials, do the following:

Note: Cloud account credentials are only available for AWS, Azure, SCVMM, and VMware cloud accounts. Credentials for GCP and K8s are currently unsupported.

  1. Enable the embotics.workflow.script.credentials system property. For more information, see Setting system properties in Commander.
  2. In the Execute Script and Execute Embedded Script steps, enter any of the following variables into the Script Contents:
    • For AWS cloud accounts:
      • $AccessKey = (Get-Item Env:AWS_ACCESS_KEY_ID).value;
      • $SecretKey = (Get-Item Env:AWS_SECRET_ACCESS_KEY).value;
    • For Azure cloud accounts:
      • $SubscriptionId = (Get-Item Env:AZURE_SUBSCRIPTION_ID).value;
      • $ApiKey = (Get-Item Env:AZURE_API_KEY).value;
      • $TennantId = (Get-Item Env:AZURE_TENANT_ID).value;
      • $ApplicationId = (Get-Item Env:AZURE_APPLICATION_ID).value;
    • For SCVMM cloud accounts:
      • $Username = (Get-Item Env:SCVMM_USERNAME).value;
      • $Password = (Get-Item Env:SCVMM_PASSWORD).value;
    • For VMware cloud accounts:
      • $Username = (Get-Item Env:VMWARE_USERNAME).value;
      • $Password = (Get-Item Env:VMWARE_PASSWORD).value;

    For more information, see Executing Scripts through Workflow Steps.

Named Commander credential

To make a named credential available to workflow steps for connections back to Commander, do the following:

  1. Add the required named credential. For more information, see Managing Credentials.
  2. Set the value of the embotics.workflow.credentials.commander system property to the name of the credential you want to use. For more information, see Setting system properties in Commander.
  3. In the Execute Embedded Script steps, enter the following variables into the Script Contents:
    • $Username = (Get-Item Env:COMMANDER_CREDENTIALS_USERNAME).value;
    • $Password= (Get-Item Env:COMMANDER_CREDENTIALS_PASSWORD).value;

    For more information, see Executing Scripts through Workflow Steps.

Selected credential

To use the credential that you selected in the Credentials field for the workflow step, do the following:

  1. Enable the embotics.workflow.script.credentials system property. For more information, see Setting system properties in Commander.
  2. In the Execute Embedded Script steps, do the following:
    1. From the Credentials field, select the required credential.
    2. In the Script Contents, enter the following variables:
      • $Username = (Get-Item Env:SELECTED_CREDENTIALS_USERNAME).value;
      • $Password = (Get-Item Env:SELECTED_CREDENTIALS_PASSWORD).value;

    For more information, see Executing Scripts through Workflow Steps.