Posted in Marketing Cloud, Salesforce

Connect VS Code with Marketing Cloud

For Marketing Cloud developers who used to and wanted to have the features of IDE, the default browser based editor is a nightmare to edit long scripts. Here comes a savior for those!

Now you can connect your Marketing Cloud with your local Visual Studio Code with a super simple extension – AMPscript by Agadzhanov Sergey.

An actively maintained project (as of this writing) – vscode-ampscript provides us the ability to:

  • Utilize the features of Visual Studio Code.
  • Connect Marketing Cloud assets with Visual Studio Code:
    1. Blocks
    2. Emails
    3. Templates
    4. Cloud Pages
    5. Mobile Messages
  • Syntax Highlighting for AMPScript.
  • Code and Hover Snippets.

Connecting VS Code with Salesforce Marketing Cloud Instance

Setting up Marketing Cloud

  1. Login to Marketing Cloud. Make sure you have permission to create packages.
  2. Go to Setup by hovering your Name Avatar.
  3. Under the setup section, open Apps > Installed Packages.
  4. Create a new package by providing a name and description that you desire.
  5. Click Add Component button at the bottom of the page.
  6. Select API Integration and click Next.
  7. Select “Server-to-Server” Integration Type and click Next.
  8. Select the permissions that you wish. Basically you might need
    • Email – Read and Write
    • Web – Read, Write and Publish
    • Saved Content – Read and Write
  9. Click Save.
  10. If you have Business Units in your Marketing Cloud account, (Only available for Enterprise 2.0 tenant)
    1. Click on the Access Tab
    2. Make sure the Integration is enabled for the Business Unit you wanted to integrate.

Setting up Visual Studio Code

  1. Install AMPScript Extension. (Make sure you update your Visual Studio code to the latest)
  2. Open View > Command Palette.
  3. Enter MCFS: Connection Manager in the Command Palette.
  4. Click on the New Connection from the Connections List section in the page that is opened.
  5. Copy “Authentication Base URI”, “Client Id”, “Client Secret” and your MID (Business Unit ID) from the Package Page and paste the values in the appropriate fields.
  6. Click Save Changes.
  7. Now click Connect to connect to your Marketing Cloud Instance.
Connection in action

6 thoughts on “Connect VS Code with Marketing Cloud

  1. I can’t connect, it says error ‘Incorrect MID’.
    I have checked several times the MID, Auth, Client Secret and ID, but the error keeps the same.

    Any clue?

    Thank you



      1. Hi,

        I have raise the issue in github

        Before that I have created a login access with postman with the same MID and credentials, and this URI instead of and is giving me an status Ok 200

        I have seen also that the connection name does not change from My Connection1. I have saved changed, reopen VS and the json has the values I entered but the side bar doesn’t get not even the connection name.

        Thank you


    1. How did you solve the issue ?
      I have the same problem even though i checked and rechecked all the parameters. I tried deleting the connection and creating a new one but it doesn’t fix the issue :
      Unable to read directory “/” Error details: Error: Incorrect MID


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s