Authenticate to a Dev Hub

From the command palette,select SFDX:Authorize a Dev Hub and log into your Dev Hub org that has Salesforce Functions activated.

Enable Functions in Developer Hub

Before your org can work with Salesforce Functions, you must enable the Salesforce Functions org setting. Doing this creates an authenticated connection for requests between your org and Salesforce Functions.

To authenticate Salesforce Functions log in to your DevHub org, go to Setup and in the Quick Find box search for Functions. Select the Functions setup page.

Functions Setup screenshot

This setup page is only available in orgs that have Lightning Experience enabled, not Salesforce Classic.

Click Enable Functions in the Functions setup page to start creating the authenticated connection between your org and Salesforce Functions. A Salesforce sign-in browser window will open requesting your Salesforce Functions login information.

For beta, use the same credentials as your DevHub admin login credentials, or the Salesforce Functions account credentials provided to you by Salesforce.

After you’ve entered your Salesforce Functions login credentials, the connection process will complete. This can take up to a couple minutes. When the process successfully finishes, the Enable Functions button will no longer be present, and information about the connected Salesforce Functions account will be displayed in the Functions setup page.

Functions connected screenshot

If the connection process is not successful, error information will be displayed in the Functions setup page. You may attempt the process again by clicking Try Again, or contact Salesforce for help.

Authenticate CLI with Salesforce Functions

The Salesforce CLI also needs to be connected to the same Salesforce Functions account you used to connect your DevHub org. Connect your CLI using the following command in your VS Code terminal pane:

This will open a browser page where you can log in to your Salesforce Functions account using the same credentials you used to connect your DevHub org.