I am new to google cloud and trying to explore. I tried to download my project’s IAM policy as a CSV file. However, I'm having 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.
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.