mongodb-atlas-cli
mongodb-atlas-cli copied to clipboard
"atlas" CLI reports "You are not authorized for this resource" when "mongocli atlas" does not
Describe the bug A clear and concise description of the bug.
As requested, I followed the migration steps for using "atlas" rather than "mongocli atlas". However, I'm not getting the "You are not authorized for this resource" errors for the same configuration, but running the same comment through "mongocli atlas" works. I have "organizational" owner" rights.
To Reproduce
Using mongocli
$ mongocli iam projects list | grep "\"id\":" | wc -l
11
Using atlas
$ atlas projects list
Error: GET https://cloud.mongodb.com/api/atlas/v1.0/groups?itemsPerPage=100&pageNum=1: 401 (request "") You are not authorized for this resource.
Expected behavior Please explain what you expected to happen.
Screenshots If possible, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Mac OS 12.3.1 M1Pro
- MongoCLI version 1.24.1
- Atlas cli version1.0.2
- Ops Manager Version: N/A
Additional context Add any other context about the problem here.
Hi @SteveH-US before I look into possible errors on our side can you please confirm that the config files look a like?
to open the config file for mongocli
you can do mongocli config edit
for atlas you can do vi ~/Library/Application\ Support/atlascli/config.toml
Also to confirm, was the migration relying on the automated atlas cli config file creation or was this related to an automated pipeline that required manual intervention for the file?
@gssbzn
Here's my config file with the keys redacted
mongosh_path = "/Users/steveh_1/.mongodb/mongosh"
skip_update_check = true
[default]
mongosh_path = "/opt/homebrew/bin/mongosh"
org_id = "***"
output = "json"
private_api_key = "***"
project_id = "***"
public_api_key = "***"
service = "cloud"
[mom_mia]
ops_manager_url = "https://mama.mia.ulti.io/"
organization_id = "***"
private_api_key = "***"
project_id = "***"
public_api_key = "***"
service = "ops-manager"
I followed the migration instructions. It appears that the atlas config init
command reused the mongocli
config file that was there already.
There appears to be a bug in the way the atlas
cli handles the init. It appears to copy the mongocli
configuration as is when running atlas config init
. I say this because when I rename the existing file, "~/Library/Application\ Support/atlascli/config.toml" and run 'atlas config init' again, I am able to get the expected results back. So, it appears that a mongocli
configuration it copied, the one quoted above, causes the said erroneous error.
This issue has gone 30 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!