This error occurs when you try to act GCP but do not have the necessary permissions or the required API is not enabled for the project.
Reasons for The Error
- Cloud Resource Manager API Disabled: The Cloud Resource Manager API is required to manage projects and resources in GCP. The error will occur if this API has not been enabled for your project.
- Insufficient Permissions: Your user account does not have sufficient permissions to access or manage resources.
- Service Account Permissions: If you are using a service account, it might lack the appropriate permissions for the task.
Steps to Troubleshoot the Error
1. Enable the Cloud Resource Manager API:
The Cloud Resource Manager API must be enabled for the project where you’re working. You can enable it using the following steps:
Step 1. Go to the GCP Console API Library.
Step 2. In the search bar, type Cloud Resource Manager API.
Step 3. Click on the API and then click the Enable button.
2. Check and Update Permissions:
If the error persists after enabling the API, it’s likely a permissions issue. You will need to ensure that your account or service account has the appropriate permissions to access and manage resources.
- For User Accounts:
Step 1. In the GCP Console, go to IAM & Admin > IAM.
Step 2. Check whether your user account has sufficient permissions. For managing resources, roles like roles/owner, roles/editor, or roles/resourcemanager.projectIamAdmin might be required.
Step 3. If your account lacks these permissions, ask an admin to grant them.
- For Service Accounts:
Step 1. Ensure the service account has the necessary IAM roles.
Step 2. You can grant the required roles using the following command:
By following these steps, you should be able to resolve the PERMISSION_DENIED: Cloud Resource Manager API error
Consult Xieles to get help with these types of errors.