En la parte superior de la página Access Context Manager, haz clic en Nuevo.
En el panel Nivel de acceso nuevo, haz lo siguiente:
En el cuadro de texto Título del nivel de acceso, ingresa un título para el nivel de acceso.
El título debe tener un máximo de 50 caracteres y comenzar con una letra, y solo puede contener números, letras, guiones bajos y espacios.
En Crear condiciones en, selecciona Modo avanzado.
En la sección Condiciones, ingresa las expresiones para tu nivel de acceso personalizado. La condición debe resolverse en un solo valor booleano.
Para obtener ejemplos y más información sobre la compatibilidad con Common Expression Language (CEL) y los niveles de acceso personalizados, consulta la especificación del nivel de acceso personalizado.
LEVEL_NAME es el nombre único para el nivel de acceso. Debe comenzar con una letra y, además, incluir solo letras, números y guiones bajos. El nombre puede tener un máximo de 50 caracteres.
TITLE es el título corto y legible para el nivel de acceso.
FILE es un archivo .yaml que contiene tu expresión CEL con el formato de un par clave-valor único: expression: "CEL_EXPRESSION".
Para obtener ejemplos y más información sobre la compatibilidad con Common Expression Language (CEL) y los niveles de acceso personalizados, consulta la especificación del nivel de acceso personalizado.
DESCRIPTION es una descripción legible del nivel de acceso (opcional).
POLICY_NAME es el nombre numérico de la política de acceso de tu organización.
Cuando usas la herramienta de línea de comandos de gcloud con el fin de crear un nivel de acceso personalizado, debes proporcionar un archivo .yaml para la opción custom-level-spec. El archivo .yaml define una expresión CEL que se resuelve en un solo valor booleano. El archivo .yaml debe contener un solo par clave-valor con el formato expression: "CEL_EXPRESSION". El valor de expression debe ser una string.
Ejemplo de archivo YAML
expression:"device.encryption_status == DeviceEncryptionStatus.ENCRYPTED && (origin.region_code in ['US'] || device.is_admin_approved_device)"
Comando de ejemplo
gcloudaccess-context-managerlevelscreateCustom_Trust\--custom-level-spec=customspec.yaml\--description="Custom access level for corp."\--title="Custom Trust Level"\--policy=1521580097614100
En el campo custom, crea un objeto que incluya las expresiones CEL para tu nivel de acceso personalizado. La expresión completa debe resolverse como un valor booleano. Los campos title y description son opcionales.
Ejemplo
{"name":"example_custom_level","title":"Example custom level","description":"An example custom access level.","custom":{"expr":{"expression":"device.is_corp_owned == true || (device.os_type != OsType.OS_UNSPECIFIED && device.is_admin_approved_device == true)","title":"Check for known devices","description":"Permits requests from corp-owned devices and admin-approved devices with a known OS."}}}
Para crear un nivel de acceso personalizado, llama a CreateAccessLevel.
En el campo access_level, incluye una instancia de AccessLevel.
Campos
name
Tipo
string
Descripción
Obligatorio
El nombre del recurso del nivel de acceso. POLICY_ID es el nombre numérico de la política de acceso de tu organización. La SHORT_NAME debe comenzar con una letra e incluir solo letras, números y guiones bajos.
Formato:
accessPolicies/policy_id/accessLevels/short_name
title
Tipo
string
Descripción
Una etiqueta legible para el nivel de acceso. Los niveles de acceso deben tener nombres únicos.
description
Tipo
string
Descripción
Una descripción del nivel de acceso.
custom
Tipo
string
Descripción
Las expresiones CEL para tu nivel de acceso personalizado. La expresión completa debe resolverse en un valor booleano.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eThis feature to create custom access levels is only available with a paid enterprise security subscription, which you can sign up for if interested.\u003c/p\u003e\n"],["\u003cp\u003eCustom access levels are created using Common Expression Language (CEL) expressions, and after they are created can be managed like basic access levels.\u003c/p\u003e\n"],["\u003cp\u003eCustom access levels can be created in the Google Cloud console by entering a title, selecting Advanced Mode, and entering CEL expressions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud\u003c/code\u003e command-line tool allows for the creation of custom access levels using a \u003ccode\u003e.yaml\u003c/code\u003e file containing a single CEL expression.\u003c/p\u003e\n"],["\u003cp\u003eCustom access levels can also be created using REST and RPC methods by including an instance of the \u003ccode\u003eAccessLevel\u003c/code\u003e object, with the CEL expression, in the request.\u003c/p\u003e\n"]]],[],null,["# Creating a custom access level\n\n| **Note:** This feature is available only as part of a paid enterprise security subscription. You can [sign up](https://go.chronicle.security/beyondcorp-upgrade) if interested.\n\nAfter a custom access level is created, it can\nbe [managed in the same manner as basic access levels](/access-context-manager/docs/manage-access-levels).\n\nFor details about building Common Expression Language (CEL) expressions for\ncustom access levels, refer to the\n[custom access level specification](/access-context-manager/docs/custom-access-level-spec). \n\n### Console\n\nTo create a custom access level:\n\n1. Open the **Access Context Manager** page in the Google Cloud console.\n\n [Open the Access Context Manager page](https://console.cloud.google.com/security/access-level)\n2. If you are prompted, select your organization.\n\n3. At the top of the **Access Context Manager** page, click **New**.\n\n4. In the **New Access Level** pane:\n\n 1. In the **Access level title** box, enter a title for the access level.\n The title must be at most 50 characters, start with a letter, and can\n contain only numbers, letters, underscores, and spaces.\n\n 2. Following **Create Conditions in** , select **Advanced Mode**.\n\n 3. In the **Conditions** section, enter the expressions for your custom\n access level. The condition must resolve to a single boolean value.\n\n For examples and more information about Common Expression Language\n (CEL) support and custom access levels, see the [Custom access level\n specification](/access-context-manager/docs/custom-access-level-spec).\n 4. Click **Save**.\n\n### gcloud\n\n### Before you begin\n\n- If it doesn't exist yet, [create an access policy](/access-context-manager/docs/create-access-policy) for your organization.\n\nTo create a custom access level using the `gcloud` command-line tool, use the\n[`gcloud access-context-manager levels create`](/sdk/gcloud/reference/access-context-manager/levels/create) command. \n\n```bash\ngcloud access-context-manager levels create LEVEL_NAME \\\n --title=TITLE \\\n --custom-level-spec=FILE \\\n --description=DESCRIPTION \\\n --policy=POLICY_NAME\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eLEVEL_NAME\u003c/var\u003e is a unique name for the access level. It must\n begin with a letter and include only letters, numbers, and\n underscores. The name can be a maximum of 50 characters.\n\n- \u003cvar translate=\"no\"\u003eTITLE\u003c/var\u003e is the short, human-readable title for the access\n level.\n\n- \u003cvar translate=\"no\"\u003eFILE\u003c/var\u003e is a .yaml file that contains your CEL expression\n formatted as a single key-value pair:\n `expression: \"`\u003cvar translate=\"no\"\u003eCEL_EXPRESSION\u003c/var\u003e`\"`.\n\n For examples and more information about Common Expression Language (CEL)\n support and custom access levels, see the\n [Custom access level specification](/access-context-manager/docs/custom-access-level-spec).\n- \u003cvar translate=\"no\"\u003eDESCRIPTION\u003c/var\u003e (optional) is a human-readable description of the\n access level.\n\n- \u003cvar translate=\"no\"\u003ePOLICY_NAME\u003c/var\u003e is the numeric name of your organization's\n access policy.\n\nOptionally, you can include any of the\n[`gcloud`-wide flags](/sdk/gcloud/reference).\n\n### `custom-level-spec` YAML file\n\nWhen you use the `gcloud` command-line tool to create a custom access level, you must provide\na .yaml file for the `custom-level-spec` option. The .yaml file defines\na CEL expression that resolves to a single boolean value. The .yaml file\nmust contain a single key-value pair formatted as\n`expression: \"`\u003cvar translate=\"no\"\u003eCEL_EXPRESSION\u003c/var\u003e`\"`. The value for `expression` must\nbe a string.\n\n#### Example YAML file\n\n expression: \"device.encryption_status == DeviceEncryptionStatus.ENCRYPTED && (origin.region_code in ['US'] || device.is_admin_approved_device)\"\n\n### Example command\n\n gcloud access-context-manager levels create Custom_Trust \\\n --custom-level-spec=customspec.yaml \\\n --description=\"Custom access level for corp.\" \\\n --title=\"Custom Trust Level\" \\\n --policy=1521580097614100\n\n### REST\n\n### Before you begin\n\n- If it doesn't exist yet, [create an access policy](/access-context-manager/docs/create-access-policy) for your organization.\n\nTo create a custom access level, use the\n[`accessPolicies.accessLevels.create`](/access-context-manager/docs/reference/rest/v1/accessPolicies.accessLevels/create)\nmethod.\n\nRequest body\n------------\n\nIn the request body for the call, include an instance of the `AccessLevel`\nobject. \n\n {\n \"name\": string,\n \"title\": string,\n \"description\": string,\n \"custom\": {\n \"expr\": {\n \"expression\": string,\n \"title\": string,\n \"description\": string\n }\n }\n }\n\nFor the `custom` field, create an object that includes the CEL expressions\nfor your custom access level. The complete expression must resolve to a\nboolean value. The `title` and `description` fields are optional.\n\n### Example\n\n {\n \"name\": \"example_custom_level\",\n \"title\": \"Example custom level\",\n \"description\": \"An example custom access level.\",\n \"custom\": {\n \"expr\": {\n \"expression\": \"device.is_corp_owned == true || (device.os_type != OsType.OS_UNSPECIFIED && device.is_admin_approved_device == true)\",\n \"title\": \"Check for known devices\",\n \"description\": \"Permits requests from corp-owned devices and admin-approved devices with a known OS.\"\n }\n }\n }\n\n### RPC\n\n### Before you begin\n\n- If it doesn't exist yet, [create an access policy](/access-context-manager/docs/create-access-policy) for your organization.\n\nTo create a custom access level, call\n[`CreateAccessLevel`](/access-context-manager/docs/reference/rpc/google.identity.accesscontextmanager.v1#accesscontextmanager).\n\nFor the `access_level` field, include an instance of `AccessLevel`."]]