- HTTP request
- Request body
- Response body
- Authorization scopes
- AccessTuple
- ConditionContext
- Resource
- Peer
- Request
- EffectiveTag
- OverallAccessState
- AllowPolicyExplanation
- AllowAccessState
- ExplainedAllowPolicy
- AllowBindingExplanation
- RolePermissionInclusionState
- HeuristicRelevance
- AnnotatedAllowMembership
- MembershipMatchingState
- ConditionExplanation
- EvaluationState
- DenyPolicyExplanation
- DenyAccessState
- ExplainedDenyResource
- ExplainedDenyPolicy
- DenyRuleExplanation
- AnnotatedPermissionMatching
- PermissionPatternMatchingState
- AnnotatedDenyPrincipalMatching
- Try it!
Checks whether a principal has a specific permission for a specific resource, and explains why the principal does or doesn't have that permission.
HTTP request
POST https://policytroubleshooter.googleapis.com/v3/iam:troubleshoot
The URL uses gRPC Transcoding syntax.
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"accessTuple": {
object ( |
Fields | |
---|---|
accessTuple |
The information to use for checking whether a principal has a permission for a resource. |
Response body
Response for iam.troubleshoot
.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{ "overallAccessState": enum ( |
Fields | |
---|---|
overallAccessState |
Indicates whether the principal has the specified permission for the specified resource, based on evaluating all types of the applicable IAM policies. |
accessTuple |
The access tuple from the request, including any provided context used to evaluate the condition. |
allowPolicyExplanation |
An explanation of how the applicable IAM allow policies affect the final access state. |
denyPolicyExplanation |
An explanation of how the applicable IAM deny policies affect the final access state. |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
AccessTuple
Information about the principal, resource, and permission to check.
JSON representation |
---|
{
"principal": string,
"fullResourceName": string,
"permission": string,
"permissionFqdn": string,
"conditionContext": {
object ( |
Fields | |
---|---|
principal |
Required. The email address of the principal whose access you want to check. For example, The principal must be a Google Account or a service account. Other types of principals are not supported. |
fullResourceName |
Required. The full resource name that identifies the resource. For example, For examples of full resource names for Google Cloud services, see https://cloud.google.com/iam/help/troubleshooter/full-resource-names. |
permission |
Required. The IAM permission to check for, either in the For a complete list of IAM permissions in the For a list of IAM permissions in the For a complete list of predefined IAM roles and the permissions in each role, see https://cloud.google.com/iam/help/roles/reference. |
permissionFqdn |
Output only. The permission that Policy Troubleshooter checked for, in the |
conditionContext |
Optional. Additional context for the request, such as the request time or IP address. This context allows Policy Troubleshooter to troubleshoot conditional role bindings and deny rules. |
ConditionContext
Additional context for troubleshooting conditional role bindings and deny rules.
JSON representation |
---|
{ "resource": { object ( |
Fields | |
---|---|
resource |
Represents a target resource that is involved with a network activity. If multiple resources are involved with an activity, this must be the primary one. |
destination |
The destination of a network activity, such as accepting a TCP connection. In a multi-hop network activity, the destination represents the receiver of the last hop. |
request |
Represents a network request, such as an HTTP request. |
effectiveTags[] |
Output only. The effective tags on the resource. The effective tags are fetched during troubleshooting. |
Resource
Core attributes for a resource. A resource is an addressable (named) entity provided by the destination service. For example, a Compute Engine instance.
JSON representation |
---|
{ "service": string, "name": string, "type": string } |
Fields | |
---|---|
service |
The name of the service that this resource belongs to, such as For a full list of resource service values, see https://cloud.google.com/iam/help/conditions/resource-services |
name |
The stable identifier (name) of a resource on the For a list of full resource name formats, see https://cloud.google.com/iam/help/troubleshooter/full-resource-names |
type |
The type of the resource, in the format For a full list of resource type values, see https://cloud.google.com/iam/help/conditions/resource-types |
Peer
This message defines attributes for a node that handles a network request. The node can be either a service or an application that sends, forwards, or receives the request. Service peers should fill in principal
and labels
as appropriate.
JSON representation |
---|
{ "ip": string, "port": string } |
Fields | |
---|---|
ip |
The IPv4 or IPv6 address of the peer. |
port |
The network port of the peer. |
Request
This message defines attributes for an HTTP request. If the actual request is not an HTTP request, the runtime system should try to map the actual request to an equivalent HTTP request.
JSON representation |
---|
{ "receiveTime": string } |
Fields | |
---|---|
receiveTime |
Optional. The timestamp when the destination service receives the first byte of the request. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
EffectiveTag
A tag that applies to a resource during policy evaluation. Tags can be either directly bound to a resource or inherited from its ancestor. EffectiveTag
contains the name
and namespaced_name
of the tag value and tag key, with additional fields of inherited
to indicate the inheritance status of the effective tag.
JSON representation |
---|
{ "tagValue": string, "namespacedTagValue": string, "tagKey": string, "namespacedTagKey": string, "tagKeyParentName": string, "inherited": boolean } |
Fields | |
---|---|
tagValue |
Output only. Resource name for TagValue in the format |
namespacedTagValue |
Output only. The namespaced name of the TagValue. Can be in the form |
tagKey |
Output only. The name of the TagKey, in the format |
namespacedTagKey |
Output only. The namespaced name of the TagKey. Can be in the form |
tagKeyParentName |
The parent name of the tag key. Must be in the format |
inherited |
Output only. Indicates the inheritance status of a tag value attached to the given resource. If the tag value is inherited from one of the resource's ancestors, inherited will be true. If false, then the tag value is directly attached to the resource, inherited will be false. |
OverallAccessState
Whether the principal has the permission on the resource.
Enums | |
---|---|
OVERALL_ACCESS_STATE_UNSPECIFIED |
Not specified. |
CAN_ACCESS |
The principal has the permission. |
CANNOT_ACCESS |
The principal doesn't have the permission. |
UNKNOWN_INFO |
The principal might have the permission, but the sender can't access all of the information needed to fully evaluate the principal's access. |
UNKNOWN_CONDITIONAL |
The principal might have the permission, but Policy Troubleshooter can't fully evaluate the principal's access because the sender didn't provide the required context to evaluate the condition. |
AllowPolicyExplanation
Details about how the relevant IAM allow policies affect the final access state.
JSON representation |
---|
{ "allowAccessState": enum ( |
Fields | |
---|---|
allowAccessState |
Indicates whether the principal has the specified permission for the specified resource, based on evaluating all applicable IAM allow policies. |
explainedPolicies[] |
List of IAM allow policies that were evaluated to check the principal's permissions, with annotations to indicate how each policy contributed to the final result. The list of policies includes the policy for the resource itself, as well as allow policies that are inherited from higher levels of the resource hierarchy, including the organization, the folder, and the project. To learn more about the resource hierarchy, see https://cloud.google.com/iam/help/resource-hierarchy. |
relevance |
The relevance of the allow policy type to the overall access state. |
AllowAccessState
Whether IAM allow policies gives the principal the permission.
Enums | |
---|---|
ALLOW_ACCESS_STATE_UNSPECIFIED |
Not specified. |
ALLOW_ACCESS_STATE_GRANTED |
The allow policy gives the principal the permission. |
ALLOW_ACCESS_STATE_NOT_GRANTED |
The allow policy doesn't give the principal the permission. |
ALLOW_ACCESS_STATE_UNKNOWN_CONDITIONAL |
The allow policy gives the principal the permission if a condition expression evaluate to true . However, the sender of the request didn't provide enough context for Policy Troubleshooter to evaluate the condition expression. |
ALLOW_ACCESS_STATE_UNKNOWN_INFO |
The sender of the request doesn't have access to all of the allow policies that Policy Troubleshooter needs to evaluate the principal's access. |
ExplainedAllowPolicy
Details about how a specific IAM allow policy contributed to the final access state.
JSON representation |
---|
{ "allowAccessState": enum ( |
Fields | |
---|---|
allowAccessState |
Required. Indicates whether this policy provides the specified permission to the specified principal for the specified resource. This field does not indicate whether the principal actually has the permission for the resource. There might be another policy that overrides this policy. To determine whether the principal actually has the permission, use the |
fullResourceName |
The full resource name that identifies the resource. For example, If the sender of the request does not have access to the policy, this field is omitted. For examples of full resource names for Google Cloud services, see https://cloud.google.com/iam/help/troubleshooter/full-resource-names. |
bindingExplanations[] |
Details about how each role binding in the policy affects the principal's ability, or inability, to use the permission for the resource. The order of the role bindings matches the role binding order in the policy. If the sender of the request does not have access to the policy, this field is omitted. |
relevance |
The relevance of this policy to the overall access state in the If the sender of the request does not have access to the policy, this field is omitted. |
policy |
The IAM allow policy attached to the resource. If the sender of the request does not have access to the policy, this field is empty. |
AllowBindingExplanation
Details about how a role binding in an allow policy affects a principal's ability to use a permission.
JSON representation |
---|
{ "allowAccessState": enum ( |
Fields | |
---|---|
allowAccessState |
Required. Indicates whether this role binding gives the specified permission to the specified principal on the specified resource. This field does not indicate whether the principal actually has the permission on the resource. There might be another role binding that overrides this role binding. To determine whether the principal actually has the permission, use the |
role |
The role that this role binding grants. For example, For a complete list of predefined IAM roles, as well as the permissions in each role, see https://cloud.google.com/iam/help/roles/reference. |
rolePermission |
Indicates whether the role granted by this role binding contains the specified permission. |
rolePermissionRelevance |
The relevance of the permission's existence, or nonexistence, in the role to the overall determination for the entire policy. |
combinedMembership |
The combined result of all memberships. Indicates if the principal is included in any role binding, either directly or indirectly. |
memberships |
Indicates whether each role binding includes the principal specified in the request, either directly or indirectly. Each key identifies a principal in the role binding, and each value indicates whether the principal in the role binding includes the principal in the request. For example, suppose that a role binding includes the following principals:
You want to troubleshoot access for For the first principal in the role binding, the key is For the second principal in the role binding, the key is An object containing a list of |
relevance |
The relevance of this role binding to the overall determination for the entire policy. |
condition |
A condition expression that specifies when the role binding grants access. To learn about IAM Conditions, see https://cloud.google.com/iam/help/conditions/overview. |
conditionExplanation |
Condition evaluation state for this role binding. |
RolePermissionInclusionState
Whether a role includes a specific permission.
Enums | |
---|---|
ROLE_PERMISSION_INCLUSION_STATE_UNSPECIFIED |
Not specified. |
ROLE_PERMISSION_INCLUDED |
The permission is included in the role. |
ROLE_PERMISSION_NOT_INCLUDED |
The permission is not included in the role. |
ROLE_PERMISSION_UNKNOWN_INFO |
The sender of the request is not allowed to access the role definition. |
HeuristicRelevance
The extent to which a single data point contributes to an overall determination.
Enums | |
---|---|
HEURISTIC_RELEVANCE_UNSPECIFIED |
Not specified. |
HEURISTIC_RELEVANCE_NORMAL |
The data point has a limited effect on the result. Changing the data point is unlikely to affect the overall determination. |
HEURISTIC_RELEVANCE_HIGH |
The data point has a strong effect on the result. Changing the data point is likely to affect the overall determination. |
AnnotatedAllowMembership
Details about whether the role binding includes the principal.
JSON representation |
---|
{ "membership": enum ( |
Fields | |
---|---|
membership |
Indicates whether the role binding includes the principal. |
relevance |
The relevance of the principal's status to the overall determination for the role binding. |
MembershipMatchingState
Whether the principal in the request matches the principal in the policy.
Enums | |
---|---|
MEMBERSHIP_MATCHING_STATE_UNSPECIFIED |
Not specified. |
MEMBERSHIP_MATCHED |
The principal in the request matches the principal in the policy. The principal can be included directly or indirectly:
|
MEMBERSHIP_NOT_MATCHED |
The principal in the request doesn't match the principal in the policy. |
MEMBERSHIP_UNKNOWN_INFO |
The principal in the policy is a group or domain, and the sender of the request doesn't have permission to view whether the principal in the request is a member of the group or domain. |
MEMBERSHIP_UNKNOWN_UNSUPPORTED |
The principal is an unsupported type. |
ConditionExplanation
Explanation for how a condition affects a principal's access
JSON representation |
---|
{ "value": value, "errors": [ { object ( |
Fields | |
---|---|
value |
Value of the condition. |
errors[] |
Any errors that prevented complete evaluation of the condition expression. |
evaluationStates[] |
The value of each statement of the condition expression. The value can be |
EvaluationState
Evaluated state of a condition expression.
JSON representation |
---|
{
"start": integer,
"end": integer,
"value": value,
"errors": [
{
object ( |
Fields | |
---|---|
start |
Start position of an expression in the condition, by character. |
end |
End position of an expression in the condition, by character, end included, for example: the end position of the first part of |
value |
Value of this expression. |
errors[] |
Any errors that prevented complete evaluation of the condition expression. |
DenyPolicyExplanation
Details about how the relevant IAM deny policies affect the final access state.
JSON representation |
---|
{ "denyAccessState": enum ( |
Fields | |
---|---|
denyAccessState |
Indicates whether the principal is denied the specified permission for the specified resource, based on evaluating all applicable IAM deny policies. |
explainedResources[] |
List of resources with IAM deny policies that were evaluated to check the principal's denied permissions, with annotations to indicate how each policy contributed to the final result. The list of resources includes the policy for the resource itself, as well as policies that are inherited from higher levels of the resource hierarchy, including the organization, the folder, and the project. The order of the resources starts from the resource and climbs up the resource hierarchy. To learn more about the resource hierarchy, see https://cloud.google.com/iam/help/resource-hierarchy. |
relevance |
The relevance of the deny policy result to the overall access state. |
permissionDeniable |
Indicates whether the permission to troubleshoot is supported in deny policies. |
DenyAccessState
Whether IAM deny policies deny the principal the permission.
Enums | |
---|---|
DENY_ACCESS_STATE_UNSPECIFIED |
Not specified. |
DENY_ACCESS_STATE_DENIED |
The deny policy denies the principal the permission. |
DENY_ACCESS_STATE_NOT_DENIED |
The deny policy doesn't deny the principal the permission. |
DENY_ACCESS_STATE_UNKNOWN_CONDITIONAL |
The deny policy denies the principal the permission if a condition expression evaluates to true . However, the sender of the request didn't provide enough context for Policy Troubleshooter to evaluate the condition expression. |
DENY_ACCESS_STATE_UNKNOWN_INFO |
The sender of the request does not have access to all of the deny policies that Policy Troubleshooter needs to evaluate the principal's access. |
ExplainedDenyResource
Details about how a specific resource contributed to the deny policy evaluation.
JSON representation |
---|
{ "denyAccessState": enum ( |
Fields | |
---|---|
denyAccessState |
Required. Indicates whether any policies attached to this resource deny the specific permission to the specified principal for the specified resource. This field does not indicate whether the principal actually has the permission for the resource. There might be another policy that overrides this policy. To determine whether the principal actually has the permission, use the |
fullResourceName |
The full resource name that identifies the resource. For example, If the sender of the request does not have access to the policy, this field is omitted. For examples of full resource names for Google Cloud services, see https://cloud.google.com/iam/help/troubleshooter/full-resource-names. |
explainedPolicies[] |
List of IAM deny policies that were evaluated to check the principal's denied permissions, with annotations to indicate how each policy contributed to the final result. |
relevance |
The relevance of this policy to the overall access state in the If the sender of the request does not have access to the policy, this field is omitted. |
ExplainedDenyPolicy
Details about how a specific IAM deny policy Policy
contributed to the access check.
JSON representation |
---|
{ "denyAccessState": enum ( |
Fields | |
---|---|
denyAccessState |
Required. Indicates whether this policy denies the specified permission to the specified principal for the specified resource. This field does not indicate whether the principal actually has the permission for the resource. There might be another policy that overrides this policy. To determine whether the principal actually has the permission, use the |
policy |
The IAM deny policy attached to the resource. If the sender of the request does not have access to the policy, this field is omitted. |
ruleExplanations[] |
Details about how each rule in the policy affects the principal's inability to use the permission for the resource. The order of the deny rule matches the order of the rules in the deny policy. If the sender of the request does not have access to the policy, this field is omitted. |
relevance |
The relevance of this policy to the overall access state in the If the sender of the request does not have access to the policy, this field is omitted. |
DenyRuleExplanation
Details about how a deny rule in a deny policy affects a principal's ability to use a permission.
JSON representation |
---|
{ "denyAccessState": enum ( |
Fields | |
---|---|
denyAccessState |
Required. Indicates whether this rule denies the specified permission to the specified principal for the specified resource. This field does not indicate whether the principal is actually denied on the permission for the resource. There might be another rule that overrides this rule. To determine whether the principal actually has the permission, use the |
combinedDeniedPermission |
Indicates whether the permission in the request is listed as a denied permission in the deny rule. |
deniedPermissions |
Lists all denied permissions in the deny rule and indicates whether each permission matches the permission in the request. Each key identifies a denied permission in the rule, and each value indicates whether the denied permission matches the permission in the request. An object containing a list of |
combinedExceptionPermission |
Indicates whether the permission in the request is listed as an exception permission in the deny rule. |
exceptionPermissions |
Lists all exception permissions in the deny rule and indicates whether each permission matches the permission in the request. Each key identifies a exception permission in the rule, and each value indicates whether the exception permission matches the permission in the request. An object containing a list of |
combinedDeniedPrincipal |
Indicates whether the principal is listed as a denied principal in the deny rule, either directly or through membership in a principal set. |
deniedPrincipals |
Lists all denied principals in the deny rule and indicates whether each principal matches the principal in the request, either directly or through membership in a principal set. Each key identifies a denied principal in the rule, and each value indicates whether the denied principal matches the principal in the request. An object containing a list of |
combinedExceptionPrincipal |
Indicates whether the principal is listed as an exception principal in the deny rule, either directly or through membership in a principal set. |
exceptionPrincipals |
Lists all exception principals in the deny rule and indicates whether each principal matches the principal in the request, either directly or through membership in a principal set. Each key identifies a exception principal in the rule, and each value indicates whether the exception principal matches the principal in the request. An object containing a list of |
relevance |
The relevance of this role binding to the overall determination for the entire policy. |
condition |
A condition expression that specifies when the deny rule denies the principal access. To learn about IAM Conditions, see https://cloud.google.com/iam/help/conditions/overview. |
conditionExplanation |
Condition evaluation state for this role binding. |
AnnotatedPermissionMatching
Details about whether the permission in the request is denied by the deny rule.
JSON representation |
---|
{ "permissionMatchingState": enum ( |
Fields | |
---|---|
permissionMatchingState |
Indicates whether the permission in the request is denied by the deny rule. |
relevance |
The relevance of the permission status to the overall determination for the rule. |
PermissionPatternMatchingState
Whether the permission in the request matches the permission in the policy.
Enums | |
---|---|
PERMISSION_PATTERN_MATCHING_STATE_UNSPECIFIED |
Not specified. |
PERMISSION_PATTERN_MATCHED |
The permission in the request matches the permission in the policy. |
PERMISSION_PATTERN_NOT_MATCHED |
The permission in the request matches the permission in the policy. |
AnnotatedDenyPrincipalMatching
Details about whether the principal in the request is listed as a denied principal in the deny rule, either directly or through membership in a principal set.
JSON representation |
---|
{ "membership": enum ( |
Fields | |
---|---|
membership |
Indicates whether the principal is listed as a denied principal in the deny rule, either directly or through membership in a principal set. |
relevance |
The relevance of the principal's status to the overall determination for the role binding. |