Untuk mengetahui detail tentang cara membuat ekspresi Common Expression Language (CEL) untuk tingkat akses kustom, lihat spesifikasi tingkat akses kustom.
Konsol
Untuk membuat tingkat akses kustom:
Buka halaman Access Context Manager di Google Cloud console.
Di bagian atas halaman Access Context Manager, klik New.
Di panel New Access Level:
Di kotak Access level title, masukkan judul untuk tingkat akses.
Judul harus maksimal 50 karakter, diawali dengan huruf, dan hanya boleh
berisi angka, huruf, garis bawah, dan spasi.
Setelah Buat Kondisi di, pilih Mode Lanjutan.
Di bagian Kondisi, masukkan ekspresi untuk tingkat akses kustom Anda. Kondisi harus me-resolve ke satu nilai boolean.
Untuk mengetahui contoh dan informasi selengkapnya tentang dukungan Common Expression Language (CEL) dan tingkat akses kustom, lihat Spesifikasi tingkat akses kustom.
LEVEL_NAME adalah nama unik untuk tingkat akses. Nama ini
harus diawali dengan huruf dan hanya menyertakan huruf, angka, serta
garis bawah. Nama dapat berisi maksimal 50 karakter.
TITLE adalah judul singkat yang dapat dibaca manusia untuk tingkat akses.
FILE adalah file .yaml yang berisi ekspresi CEL Anda yang diformat sebagai satu pasangan nilai kunci: expression: "CEL_EXPRESSION".
Untuk mengetahui contoh dan informasi selengkapnya tentang dukungan Common Expression Language (CEL)
dan tingkat akses kustom, lihat
Spesifikasi tingkat akses kustom.
DESCRIPTION (opsional) adalah deskripsi tingkat akses yang dapat dibaca manusia.
POLICY_NAME adalah nama numerik kebijakan akses
organisasi Anda.
Secara opsional, Anda dapat menyertakan salah satu
flag gcloud-wide.
File YAML custom-level-spec
Saat menggunakan alat command line gcloud untuk membuat tingkat akses kustom, Anda harus memberikan
file .yaml untuk opsi custom-level-spec. File .yaml menentukan
ekspresi CEL yang me-resolve ke satu nilai boolean. File .yaml
harus berisi satu pasangan nilai kunci yang diformat sebagai
expression: "CEL_EXPRESSION". Nilai untuk expression harus
berbentuk string.
Contoh file YAML
expression:"device.encryption_status == DeviceEncryptionStatus.ENCRYPTED && (origin.region_code in ['US'] || device.is_admin_approved_device)"
Contoh perintah
gcloudaccess-context-managerlevelscreateCustom_Trust\--custom-level-spec=customspec.yaml\--description="Custom access level for corp."\--title="Custom Trust Level"\--policy=1521580097614100
Untuk kolom custom, buat objek yang menyertakan ekspresi CEL
untuk tingkat akses kustom Anda. Ekspresi lengkap harus di-resolve ke
nilai boolean. Kolom title dan description bersifat opsional.
Contoh
{"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."}}}
Untuk kolom access_level, sertakan instance AccessLevel.
Kolom
name
Jenis
string
Deskripsi
Wajib.
Nama resource untuk tingkat akses. POLICY_ID adalah nama numerik kebijakan akses Organisasi Anda. SHORT_NAME
harus diawali dengan huruf, dan
hanya menyertakan huruf, angka, serta garis bawah.
Format:
accessPolicies/policy_id/accessLevels/short_name
title
Jenis
string
Deskripsi
Label yang dapat dibaca manusia untuk tingkat akses. Tingkat akses
harus memiliki nama yang unik.
description
Jenis
string
Deskripsi
Deskripsi tingkat akses.
custom
Jenis
string
Deskripsi
Ekspresi CEL untuk tingkat akses kustom Anda. Ekspresi lengkap harus di-resolve ke nilai boolean.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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`."]]