Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error in downloading gcloud project’s IAM policy

I am nee to google cloud and trying to explore. I tried to download my project’s IAM policy as a CSV file however I am encountering an error:

(gcloud.projects.get-iam-policy) Format [csv] requires a non-empty projection.

Can someone help me with this?

Run the command —format csv flag, expecting to extract the iam policy in csv file. Error mentioned showed.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Error is expected when you try to extract IAM policy in csv format as there’s no built-in functionality for this. However you can instead opt to use json to extract the policies then just convert it to csv after.
Enter the below commands in the shell:

$gcloud projects get-iam-policy your-project --format json > iam.json

This will output a json file with the format:

{
   "bindings": [
   {
       "members": [
       ...
       ],
       "role": "..."
   },
   {
       "members": [
           "...",
           "..."
       ],
       "role": "..."
   }
   ],
   "etag": "...",
   "version": ...
}

Hope this helps.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading