Method: exportIamPolicyAnalysis

Exports IAM policy analysis based on the specified request. This API implements the google.longrunning.Operation API allowing you to keep track of the export. The metadata contains the request to help callers to map responses to requests.

HTTP request

POST https://cloudasset.googleapis.com/v1p4beta1/{analysisQuery.parent=*/*}:exportIamPolicyAnalysis

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
analysisQuery.parent

string

Required. The relative name of the root asset. Only resources and IAM policies within the parent will be analyzed. This can only be an organization number (such as "organizations/123") or a folder number (such as "folders/123").

Authorization requires the following IAM permission on the specified resource parent:

  • cloudasset.assets.analyzeIamPolicy

Request body

The request body contains data with the following structure:

JSON representation
{
  "analysisQuery": {
    "parent": string,
    "resourceSelector": {
      "fullResourceName": string
    },
    "identitySelector": {
      "identity": string
    },
    "accessSelector": {
      "roles": [
        string
      ],
      "permissions": [
        string
      ]
    }
  },
  "options": {
    object (Options)
  },
  "outputConfig": {
    object (IamPolicyAnalysisOutputConfig)
  }
}
Fields
analysisQuery.resourceSelector

object (ResourceSelector)

Optional. Specifies a resource for analysis. Leaving it empty means ANY.

analysisQuery.identitySelector

object (IdentitySelector)

Optional. Specifies an identity for analysis. Leaving it empty means ANY.

analysisQuery.accessSelector

object (AccessSelector)

Optional. Specifies roles or permissions for analysis. Leaving it empty means ANY.

options

object (Options)

Optional. The request options.

outputConfig

object (IamPolicyAnalysisOutputConfig)

Required. Output configuration indicating where the results will be output to.

Response body

If successful, the response body contains an instance of Operation.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

Options

Contains request options.

JSON representation
{
  "expandGroups": boolean,
  "expandRoles": boolean,
  "expandResources": boolean,
  "outputResourceEdges": boolean,
  "outputGroupEdges": boolean,
  "analyzeServiceAccountImpersonation": boolean
}
Fields
expandGroups

boolean

Optional. If true, the identities section of the result will expand any Google groups appearing in an IAM policy binding.

If [identitySelector][] is specified, the identity in the result will be determined by the selector, and this flag will have no effect.

Default is false.

expandRoles

boolean

Optional. If true, the access section of result will expand any roles appearing in IAM policy bindings to include their permissions.

If [accessSelector][] is specified, the access section of the result will be determined by the selector, and this flag will have no effect.

Default is false.

expandResources

boolean

Optional. If true, the resource section of the result will expand any resource attached to an IAM policy to include resources lower in the resource hierarchy.

For example, if the request analyzes for which resources user A has permission P, and the results include an IAM policy with P on a GCP folder, the results will also include resources in that folder with permission P.

If [resourceSelector][] is specified, the resource section of the result will be determined by the selector, and this flag will have no effect. Default is false.

outputResourceEdges

boolean

Optional. If true, the result will output resource edges, starting from the policy attached resource, to any expanded resources. Default is false.

outputGroupEdges

boolean

Optional. If true, the result will output group identity edges, starting from the binding's group members, to any expanded identities. Default is false.

analyzeServiceAccountImpersonation

boolean

Optional. If true, the response will include access analysis from identities to resources via service account impersonation. This is a very expensive operation, because many derived queries will be executed.

For example, if the request analyzes for which resources user A has permission P, and there's an IAM policy states user A has iam.serviceAccounts.getAccessToken permission to a service account SA, and there's another IAM policy states service account SA has permission P to a GCP folder F, then user A potentially has access to the GCP folder F. And those advanced analysis results will be included in AnalyzeIamPolicyResponse.service_account_impersonation_analysis.

Another example, if the request analyzes for who has permission P to a GCP folder F, and there's an IAM policy states user A has iam.serviceAccounts.actAs permission to a service account SA, and there's another IAM policy states service account SA has permission P to the GCP folder F, then user A potentially has access to the GCP folder F. And those advanced analysis results will be included in AnalyzeIamPolicyResponse.service_account_impersonation_analysis.

Default is false.

IamPolicyAnalysisOutputConfig

Output configuration for export IAM policy analysis destination.

JSON representation
{
  "gcsDestination": {
    object (GcsDestination)
  }
}
Fields
gcsDestination

object (GcsDestination)

Destination on Cloud Storage.

GcsDestination

A Cloud Storage location.

JSON representation
{
  "uri": string
}
Fields
uri

string

Required. The uri of the Cloud Storage object. It's the same uri that is used by gsutil. For example: "gs://bucketName/objectName". See Viewing and Editing Object metadata for more information.

Try it!