Loading

How to use Anypoint CLI with a connected app

Data pubblicazione: Mar 14, 2025
Risoluzione

GOAL

Here are some step-by-step instructions to use Anypoint-CLI with a connected app.


PROCEDURE

  1. Download Anypoint CLI: https://docs.mulesoft.com/anypoint-cli/4.x/install
  2. Create a connected app and get the client ID and client secret:
  3. In Anypoint Platform, navigate to Access Management -> Connected Apps
  4. Click on "Create app"
  5. Enter a name for the App.
      
  6. Choose "App acts on its own behalf (client credentials)"
  7. Hit "Next" on the dialog and select the Environments for this app to have permission to access these scopes.
  8. Finally, click "Add Scopes" to exit the dialog and then click on "Save"
    Example:
    To deploy to Cloudhub you will need to give Cloudhub Organization Admin, Read Servers, View Environment and View Organization permissions
     

    Here is an animated gif for the above steps:

     
  9. Now, you can return to the screen from step 1. On the right-hand side of your app, click on "Copy Id". Please notate this down somewhere.
  10. From step 7, on the right-hand side of your app, click on "Copy Secret". Please notate this down somewhere.
  11. Article referred: https://help.salesforce.com/s/articleView?id=Creating-connected-app-and-getting-the-bearer-token-example&type=1&language=en_US
  12. Open a command prompt or terminal and set the client ID and client secret environment variables.
  • Open a command prompt or terminal and set the client ID and client secret environment variables as per documentation: https://docs.mulesoft.com/anypoint-cli/4.x/auth#env-variables
  • Here are some example commands below. Replace yourclientid, yourclientsecret, and myOrgId (get myOrgId from Access Management - Business Groups - settings - Business Group ID).
export ANYPOINT_CLIENT_ID=yourclientid
export ANYPOINT_CLIENT_SECRET=yourclientsecret
export ANYPOINT_ORG=myOrgId
anypoint-cli-v4 exchange:asset:list
Numero articolo Knowledge

001117606

 
Caricamento
Salesforce Help | Article