Set the Snyk Organization for CLI tests
Last updated
Last updated
More information
Snyk privacy policy© 2024 Snyk Limited | All product and company names and logos are trademarks of their respective owners.
If you have several Organizations in your Snyk account, before you test your code using the CLI, specify which Snyk Organization will be used for the test count.
You can find your available CLI test count on the Organization Settings page -> Usage tab -> Test Usage section -> Snyk Code field:
By default, the CLI runs tests under your Preferred Organization, as defined in your Account settings:
You can change your Preferred Organization or set another Organization for the CLI tests via the CLI.
When setting an Organization for the CLI tests, you have two options:
When setting an Organization for the CLI tests, you can use either the Organization ID or the Organization internal name. These Organization identification details are generated automatically by Snyk for each Organization when it is created. The value you select to enter in the command will be shown as the Organization name in the test results. You can find the Snyk ID and internal name on the Settings page of the Organization on the Web UI.
Follow these steps to find an Organization ID and internal name:
1. On the Snyk Web UI, open the Organization whose details you want to find:
2. Once the selected Organization is open, click the Org Settings.
3. On the Settings page of the Organization, select the General tab to find the following:
Internal name: stated in the Organization name section.
You can change the display name of an Organization, but not the internal name.
The internal name also appears in the URL of the Organization.
When using the internal name for setting the Organization for the CLI tests, copy the name from the Settings page. The internal name is always written in lowercase letters.
ID: appears in the Organization ID section. You can use the Copy button to copy the ID to the CLI.
You can set a default Organization globally for all CLI tests via the CLI. This default Organization will override the Organization set as the preferred Organization. When entering this command, you can use either the ID or internal name of the new default Organization.
Regardless of the Organization you set as a global default, you can run specific CLI tests under a different Organization.
To set a default Organization for all CLI tests, In the terminal, enter
You receive the following confirmation:
From now on, all your CLI tests will run under the specified Organization.
For example, to set the Snyk Demo Org as the default Organization for the CLI tests, use the Organization ID and enter:
From now on, all the CLI tests will run by default under the Snyk Demo Org Organization, and the Snyk Demo Org ID will appear in the test results:
You can run a specific CLI test under a different Organization from the default. When using this option, the specified Organization will override the default Organization in a specific CLI test. You can use either the ID or internal name of the Organization to run a command.
To set an Organization for a specific CLI test in the terminal, after the test
command enter:
For example, to set the Snyk Test Org as the Organization for a specific CLI test, we use the Organization internal name and enter:
The internal name of the Snyk Test Org Organization appears in the results of this test: