Create Context-Aware Access context conditions

Supported editions for this feature: Frontline Standard and Frontline Plus; Enterprise Standard and Enterprise Plus; Education Standard and Education Plus; Enterprise Essentials Plus; Cloud Identity Premium. Compare your edition

Context-Aware Access context conditions define the requirements that users or their devices must meet to access apps. You define context conditions by combining attributes such as device policy, IP subnet, or location.

Note: Context conditions were previously referred to as access levels in the Google Admin console.

How to use context conditions

After you create context conditions, you can use them in Context-Aware Access policies to control user access to apps. You can also use them in data protection rules to determine when a rule applies or create context conditions directly from a policy.

For example, you can create a context condition that requires users to connect from a specific IP address range and use an encrypted device. You can then apply this condition to an app, such as Gmail, by adding the condition to a policy.

Note: Before you create a context condition, deploy endpoint verification and turn on Context-Aware Access. For details, go to Set up endpoint verification and turn on Context-Aware Access.

Create context conditions

Context conditions consist of one or more attributes that you define. To access apps covered by a policy, users must meet these requirements. Context condition attributes include options, such as device policies, IP subnets, or other existing context conditions.

You can create context conditions in 2 modes: Basic and Advanced. Basic mode gives you a list of predefined attributes to select from. If the attributes you need aren't in the predefined list, you can build a custom context condition in Advanced mode.

Note: When you modify a context condition, the changes automatically apply to any active policies that use that condition. Make sure the changes are what you intend before you save.

Create context conditions in Basic mode

  1. In the Google Admin console, go to Menu and then Security and then Access and data control and then Context-Aware Access.

    Requires the Data security access level and rule management privileges and the Admin API groups and users read privileges.

  2. In the Policies section, click View all policies.
  3. At the top, click the Down arrow and then Create new conditions.

    Basic mode is selected by default. You define the context condition by adding one or more conditions, and then specifying one or more attributes for each condition.

    Note: If you use only Google Workspace, don't use the Google Cloud console to add or modify Context-Aware Access context conditions. Adding or changing context conditions outside the Context-Aware Access interface can cause the error Unsupported attributes are being used on Google Workspace and block users.

  4. Enter a context condition name and an optional description.

  5. For the condition that you add, specify when the condition applies:

    • Meet attributes—Users must satisfy all attributes in the condition.
    • Don't meet attributes—Users don't meet any of the attributes in the condition. This option specifies the opposite of the condition and is most often used for IP subnet attributes. For example, if you specify an IP subnet and select Don't meet attributes, only users with IP addresses outside the specified range match the condition.
  6. Click Add Attribute to add one or more attributes to the context condition:

    • IP subnet (Public)—An IPv4 or IPv6 address or routing prefix in Classless Inter-Domain Routing (CIDR) block notation.
      • This attribute doesn't support private IP addresses, including home networks.
      • Static IP addresses are supported.
      • To use a dynamic IP address, you must define a static IP subnet for the context condition. If the defined static IP subnet covers the dynamic IP address range, access is granted. Access is denied when the dynamic IP address is outside the defined static IP subnet.
    • IP subnet (Private)—Lets you define Context-Aware Access policies that include private IP subnets from Virtual Private Cloud (VPC) environments. For organizations using VPCs, this attribute helps control access to Google Workspace services and enforce Context-Aware Access policies. It applies to users accessing services through VPC infrastructure and to Google Apps Script projects that use private IP addresses.
      • To use this attribute, you need Google Cloud console permissions to list and view Google Cloud network resources, such as compute.networks.list and compute.subnetworks.list, and the appropriate Identity and Access Management (IAM) role.
      • This attribute applies only to private IP subnets within managed VPC environments. It doesn't apply to general private IP addresses, such as home networks or other non-VPC private ranges.
      • To configure this attribute, select IP subnet (Private) in the context condition builder. You can add Google Cloud projects, their associated VPC networks, and optional VPC IP subnet ranges. You don't need to configure these context conditions in the Google Cloud console.
      • User access is evaluated using the VPC that sends traffic to Google servers, even if the request originated in a different VPC.
      • The Admin console supports free-form text editing of VPC names and their subnets.
      • If you use VPC Service Controls to create perimeters for your Google Cloud resources, these restrictions apply when using the IP subnet (Private) attribute:
        • You can use internal IP addresses only in Basic mode context conditions. To use private IP addresses in an Advanced mode context condition, first create a Basic mode context condition with only IP subnet (Private) attributes and then include it in your Advanced mode context condition.
        • Avoid configuring context conditions to block internal IP addresses because doing so can cause unexpected behavior.
        • A single context condition can't combine public and private IP attributes. If you need both, create separate context conditions for each and combine them in a policy.
    • Location—Countries or regions from which the user accesses Google Workspace services. Devices with internal IP addresses aren't supported because those IP addresses aren't globally unique.
    • Device policy—Select only the device policies that you want to enforce:

      • Admin approval is required: The device must be approved.
      • Company-owned device is required.
      • Screen password protected.

        Note: On Windows, this attribute checks whether the sign-in screen opens after an inactivity timeout. This check passes when Require sign-in in Sign-in options or On resume, display login screen in Screen saver settings is turned on. It doesn't check whether a password is set.

      • Device encryption: Choose Not supported, Not encrypted, or Encrypted.

    • Device OS—Users can access Google Workspace only from the operating systems that you select. Set a minimum operating system version using the major.minor.patch format or allow any version:

      • macOS
      • Windows
      • Linux
      • ChromeOS
      • iOS
      • Android
    • Context condition—Users must meet the requirements of an existing context condition.

  7. (Optional) To add another condition to the context condition, click Add condition and select attributes.

  8. Specify how multiple conditions are combined:

    • And—Users must meet the first condition and the added condition.
    • Or—Users must meet only one of the conditions.
  9. Click Save.

  10. Choose what to do with the context condition:

Example: Context condition created in Basic mode

This example shows a context condition named corp_access. When corp_access is applied to a policy, users can access apps only from an encrypted, company-owned device in the U.S. or Canada.

Context condition name corp_access
A user gets access if they... Satisfy all the attributes in the condition
Condition 1 attribute

Device policy
Device encryption = encrypted
Company-owned device = required

Join condition 1 and condition 2 with AND
A user gets access if they... Satisfy all the attributes in the condition
Condition 2 attribute

Geographic origin
Countries = US, Canada

For more examples, go to Context-Aware Access examples for Basic mode.

Create context conditions in Advanced mode

Use Advanced mode to create context conditions that can't be built in the Basic mode condition builder. For example:

  • You need to include vendor conditions from third-party integrations.
  • You want to use advanced attributes that aren't available in Basic mode, such as certificate-based authentication.

In Advanced mode, you build custom context conditions in an editing window using Common Expression Language (CEL).

  1. In the Google Admin console, go to Menu and then Security and then Access and data control and then Context-Aware Access.

    Requires the Data security access level and rule management privileges and the Admin API groups and users read privileges.

  2. In the Policies section, click View all policies.
  3. At the top, click the Down arrow and then Create new conditions.
  4. Enter a context condition name and an optional description.
  5. Select Advanced.
  6. Write a CEL expression in the editor to build your custom context condition. For supported attributes and sample expressions, go to the Custom access level specification.
  7. Click Save to compile the expression and check for syntax errors:
    • If there are no syntax errors, your custom context condition is saved and you can add it to a policy.
    • If there are syntax errors, the Fix errors to continue message lists compiler errors in English for your expression. Fix the errors and click Save again. When the context condition saves without errors, you can add it to a policy.

Example: Context condition created in Advanced mode

This example shows a context condition that requires the following conditions to allow a request:

  • The originating device is encrypted.
  • At least one of these conditions is true:
    • The request originates in the United States.
    • The originating device is approved by an administrator.
device.encryption_status == DeviceEncryptionStatus.ENCRYPTED && (origin.region_code in ["US"] || device.is_admin_approved_device)

For more examples, go to Context-Aware Access examples for Advanced mode.

What's next


Google, Google Workspace, and related marks and logos are trademarks of Google LLC. All other company and product names are trademarks of the companies with which they are associated.