If you have only a single snyk organization (org), any projects you add or update by running snyk test
or snyk monitor
are created and updated against that org.
If you have access to multiple orgs, tests and monitor results will be run against your default organization.
If you have multiple accounts, the orgs accessible in CLI test will be dependent on which account's API token is used, or which account you were logged into when you authenticated.
If a project for which you have run the Snyk CLI test
or monitor
command appears in or tests against the wrong organization, check to see if the CLI is configured with a default organization.
Run snyk config get org
- if no org is returned, then the tests will default to the current preferred organization in your Account settings unless overridden at runtime
You can temporarily override or change the default organization when you run snyk test
or snyk monitor
.
Use --org
to override the default on a test-by-test basis (runtime)
All of the testing or monitor/report commands support the option --org=<ORG_ID>
.
The <ORG_ID>
is the name displayed in the URL of your org in the snyk UI: https://app.snyk.io/org/{{orgname}}
For more information, see the CLI help documentation
Change the default organization
You can also change the default organization for CLI use by using the command snyk config set org=<org_ID>
.
This ensures all newly tested and monitored projects are created under the organization specified.
This only affects tests run from that environment- it does not change the default org for your user in the snyk UI, and will not affect any other installations you have authenticated.
More information
For more information see the article How to select the organization to use in the CLI.