Search code examples
command-line-interfaceoracle-cloud-infrastructure

CLI returns NotAuthorizedOrNotFound


I am attempting to use CLI. I have a Window 2016 VM and need to attach a Block Volume to it. Every time I use the oci commands I get

{
  "code": "NotAuthorizedOrNotFound",
  "message": "Authorization failed or requested resource not found",
  "opc-request-id": "89A63D37EBAB44109585528869D27C6C/147FC206ECC6D799FB836D9A2ECABF6F/112AABF608CD03C4B9CE555F8AE24330",
  "status": 404
}

I have entered the user OCID, tenancy OCID, and region. Also generated a key pair and added that to my user in MyServices dashboard.

With the exception of using oci iam compartment list -c, all other commands return NotAuthorizedOrNotFound

What am I missing?

FYI - This answer did not answer/fix my particular issue because I did add the compartment ID.


Solution

  • Your authentication configuration is correct as of now, because otherwise you would be getting a 401 error.

    There are a couple issues that would lead to the issue you are seeing:

    • Your user account does not have access to perform the operations you are trying. Every user should have permissions to 'get' their own user so if you are still seeing this response for: oci iam user get --user-id {YOUR USER OCID} then you can confirm this is not the issue.

    • If you try to execute a command against one region with an OCID from another region it will likely fail. For example, if you try to get an instance in FRA but your config is pointing to us-phoenix-1, the service will fail to find the instance. A good way to detect if this is happening is to invoke the command with --debug and see which region your HTTP request is being sent to.