Overview

Updated at:

Control Policy is a permission guardrail based on the structure of your resource directory (folders or members). It lets you centrally manage resource access permission boundaries at each level and establish organization-wide or scope-specific access control rules. Control policies only define permission boundaries and do not grant permissions. To access resources, the corresponding RAM users or roles in a member account still need permissions granted through Resource Access Management (RAM).

Scenarios

When an enterprise organizes all departments under a resource directory, it needs a way to enforce organization-wide rules—such as prohibiting domain registration or log deletion—without relying on each department to self-police. Otherwise, members may violate operational rules, introduce security risks, and incur unnecessary costs. Control Policy lets the management account define access control policies centrally and attach them to folders or members in the resource directory, ensuring security compliance and cost control across the organization.

Types of access control policies

  • System access control policy

    Resource Directory provides one built-in system access control policy: FullAliyunAccess. This policy allows all operations on all cloud resources and is automatically attached to every folder and member when you enable Control Policy. You can view it but cannot create, modify, or delete it.

  • Custom access control policy

    You can create, modify, and delete custom access control policies. After creating a policy, attach it to the folders or members where it should apply for it to take effect. Detach it when it is no longer needed.

How it works

Control Policy works as follows:

  1. Enable Control Policy using the management account of your resource directory. For more information, see Enable control policy.

    After enabling Control Policy, the system attaches FullAliyunAccess to all folders and members by default. This policy allows all operations to prevent unexpected access failures caused by improper control policy configuration.

  2. Create a custom access control policy using the management account. For more information, see Create a custom control policy.

  3. Use the management account to attach the policy to folders or members in the resource directory. For more information, see Attach a custom access control policy.

    Policies can be attached to any folder or member in the resource directory. Policies attached to a folder automatically apply to all its subfolders and members. For example, if Policy A is attached to a folder and Policy B is attached to one of its subfolders, both policies apply to that subfolder and all members in it.

    Note

    Start by attaching a custom access control policy to a small set of folders or members to verify it works as expected before rolling it out more broadly.

  4. When a RAM user or RAM role in a member account accesses an Alibaba Cloud service, the system checks control policies first, followed by RAM permissions within the account. The process is as follows:

    • Evaluation starts at the member account that owns the target resource and moves up level by level through the resource directory hierarchy.

    • If a Deny statement matches at any level, the request is denied immediately (Explicit Deny). Control policy evaluation stops without checking the RAM user's or role's permissions within the account.

    • If neither a Deny nor an Allow statement matches at any level, the request is denied immediately (Explicit Deny). Control policy evaluation stops without proceeding to the next level or checking the RAM user's or role's permissions within the account.

    • If no Deny matches but an Allow matches at a level, that level passes and evaluation continues at its parent, up to the Root folder. Once the Root folder passes, control policy evaluation succeeds and the system proceeds to verify the RAM user's or role's permissions within the account. For more information, see How RAM evaluates policies.

    • Access control policies do not apply to service-linked roles. For more information about service-linked roles, see Service-linked roles.

    • The system evaluates policies attached to the target account and every level above it, ensuring that policies attached at higher levels apply to all accounts beneath them.

    Important

    Control policies apply to RAM users and RAM roles in all member accounts of a resource directory, but not to the root users of those accounts. The management account is outside the resource directory and is not a member of it, so control policies do not apply to any identities within the management account.

Allow specific Alibaba Cloud services to bypass a custom access control policy

Control policies define resource access permission boundaries for the members they are attached to. Permissions outside these boundaries cannot take effect. These restrictions also affect Alibaba Cloud services that access resources in those members.

Alibaba Cloud services may use service roles to access account resources on your behalf. If a service role's permissions exceed the boundaries defined by control policies, those permissions are restricted, which can prevent some service features from working. If this is the intended result, no further action is needed. Otherwise, use the following procedure to exempt the service role from the policy:

  1. Find the name of the service role used by the service you want to exempt.

    Log on to the RAM console to view all service roles in your account.

  2. Add a condition with Condition key: "acs:PrincipalARN" to the control policy that restricts the service role. Specify the affected service role in the PrincipalARN value as shown below to exempt it from the restriction. The following example denies ram:UpdateUser for all principals except the specified service role:

    {
        "Statement": [
            {
                "Action": [
                    "ram:UpdateUser"
                ],
                "Resource": "*",
                "Effect": "Deny",         
                "Condition": {
                    "StringNotLike": {
                        "acs:PrincipalARN":"acs:ram:*:*:role/<Name of the service role>"
                   }
               }
            }
        ],
        "Version": "1"
    }

    For more information about the syntax of access control policies, see Access control policy language.

Limits

For more information, see Limits on resource directories.

Alibaba Cloud services that do not support the Control Policy feature

  • Microservices Engine (MSE) must be upgraded to a supported engine version to use the Control Policy feature.

    For more information about MSE engine versions, see Nacos engine versions.

  • The following applications and clusters in ApsaraMQ for RocketMQ do not support the Control Policy feature:

    • The mq-http application does not support the Control Policy feature.

    • The onsbroker application does not support the Control Policy feature in the following regions:

      • UAE (Dubai).

      • China (Shanghai): The sh-share9 and shvip-st21ujm8f01 clusters in this region do not support the Control Policy feature.

      • China North 2 Ali Gov 1: The beijing.gov.vip.v0h0ovmfp02, beijing.gov.vip.nif1zmrlf02, and vip-cn-north-2-gov-1-45914plw301 clusters in this region do not support the Control Policy feature.

Scenarios

To standardize how users within your enterprise purchase and use cloud services, you can use resource directory control policies to restrict the enterprise to approved cloud services. For a practical example, see Restrict cloud services to an approved list.