How to work with different environments using Atlassian Command Line Interface (CLI)

This article explains how you can update the file to work with different environments using Atlassian Command Line Interface (CLI).

To work with multiple environments using CLI, the file must be updated with the details of the environment(s). A new feature with CLI version 9.0 provides the required configuration in the form of a standard property file. This is an alternative for defining unique start scripts or customizing the Atlassian start script with credentials and URLs. This CLI distribution folder contains properties files for both Cloud and Server. 


  1. Navigate to the CLI installation directory.
  2. To work with multiple Cloud sites and/or Server sites, you must update the file where different environments like Prod,Stage, or, QA  are targeted, as follows:

    # Example Cloud configuration - customize and rename this file to
    # Cloud requires an email address and a corresponding API token from Atlassian.
    # Use an existing token or create one at (requires an Atlassian account login).
    cloudcredentials  = --user --token xxxxxxxxxxxxxxxxxxxxxxxx
    myjira            = jiracloud       -s      ${cloudcredentials} 
    myconfluence      = confluencecloud -s      ${cloudcredentials} 
    # Example Server configuration:
    prodservercredentials = --user admin --password admin
    jiraserver            = jira       -s       ${prodservercredentials}
    confluenceserver      = confluence -s ${prodservercredentials}
    qacredentials     = --user qauser --password qapass
    qajira            = jira       -s       ${qacredentials}
    qaconfluence      = confluence -s ${qacredentials}
    # This defines the default client for actions, choose the most likely used client
    default           = ${myjira}
    • Each instance can be given a unique name that points to the respective Atlassian instance. Use this name to execute the CLI commands against the respective instance. 
    • In the above properties file, myjira is a name pointing to your Jira Cloud instance and myconfluence is the name pointing to your Confluence Cloud instance. Similarly, the other names are pointing to their respective instances.
    • A credential specifies the username and password/token for the respective instance. Please provide your user ID in user parameter and API token data in token parameter as shown:  
      credentials       = --user --token xxxxxxxxxxxxxxxxxxxxxxxx
  3. Save the file and run the following commands as per your requirement:

    acli qajira --action getServerInfo
    acli myconfluence --action addPage --space "demo"  --title "This is title"  --parent "@home"
    acli myjira --action cloneIssue  --issue "JIRACLI-4"  --summary "clone summary"  --comment "comment for cloned issue"

You can also use -a instead of --action for all CLI actions. For example: 

acli -a getServerInfo