Gets the IAM policy that is attached to a ServiceAccount. This IAM policy specifies which principals have access to the service account. This method does not tell you whether the service account has been granted any roles on other resources. To check whether a service account has role grants on a resource, use the
getIamPolicy method for that resource. For example, to view the role grants for a project, call the Resource Manager API's
You will need authorization for the https://www.googleapis.com/auth/cloud-platform scope to make a valid call.
If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform.
You can set the scope for this method like this:
iam1 --scope <scope> projects service-accounts-get-iam-policy ...
Required Scalar Argument
- <resource> (string)
- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
Optional Output Flags
The method's return value a JSON encoded structure, which will be written to standard output by default.
- -o out
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
-to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.
- out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be
Optional Method Properties
You may set the following properties to further configure the call. Please note that
-p is followed by one
or more key-value-pairs, and is called like this
-p k1=v1 k2=v2 even though the listing below repeats the
-p for completeness.
- -p options-requested-policy-version=integer
- Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the IAM documentation.
Optional General Properties
The following properties can configure any call, and are not specific to this method.
- V1 error format.
- OAuth access token.
- Data format for response.
- Selector specifying which fields to include in a partial response.
- API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
- OAuth 2.0 token for the current user.
- Returns response with indentations and line breaks.
- Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- Legacy upload protocol for media (e.g. "media", "multipart").
- Upload protocol for media (e.g. "raw", "multipart").