OCI Cloud Infrastructure: Getting 'NotAuthorizedOrNotFound' scenarios When Accessing Resource with IAM Policy
I'm trying to figure out I'm not sure how to approach I'm working on a project and hit a roadblock... I'm sure I'm missing something obvious here, but I'm currently working on a project that requires accessing specific resources in OCI using the Python SDK. I've set up my authentication using a config file, and I can list the resources without issues. However, when I attempt to access a particular VCN, I'm receiving a 'NotAuthorizedOrNotFound' behavior. Hereβs the relevant portion of my code: ```python import oci config = oci.config.from_file("~/.oci/config") # Initialize the Virtual Network Client vcn_client = oci.core.VirtualNetworkClient(config) # Attempt to get a specific VCN vcn_id = "ocid1.vcn.oc1..exampleuniqueID" response = vcn_client.get_vcn(vcn_id) print(response.data) ``` Iβve confirmed that the VCN ID is correct and the VCN exists in the specified region. Iβve also reviewed the IAM policies and granted permissions for my user group to access VCN resources, including: ```plaintext Allow group my_group to manage virtual-network in compartment my_compartment ``` Despite this, I still get the behavior. I suspect that there might be an scenario with the compartment or the user's permissions. I've tried running the code with both my user's principal and the service principal, but the behavior continues. My OCI SDK version is 2.40.0, and I'm using Python 3.8. Can anyone guide to identify what I might be missing here? Is there a specific way to debug IAM policies in OCI that could point me to the root cause of this scenario? For context: I'm using Python on Linux. How would you solve this? I'm developing on Windows 11 with Python. What's the correct way to implement this? What would be the recommended way to handle this?