gcloud compute org-security-policies rules create PRIORITY --action=ACTION --security-policy=SECURITY_POLICY [--cloud-armor] [--description=DESCRIPTION] [--dest-ip-ranges=[DEST_IP_RANGE,…]] [--direction=DIRECTION] [--[no-]enable-logging] [--layer4-configs=[LAYER4_CONFIG,…]] [--organization=ORGANIZATION] [--preview] [--target-resources=[TARGET_RESOURCES,…]] [--target-service-accounts=[TARGET_SERVICE_ACCOUNTS,…]] [--expression=EXPRESSION | --src-ip-ranges=[SRC_IP_RANGE,…]] [GCLOUD_WIDE_FLAG …]
gcloud compute org-security-policies rules create is used to create
organization security policy rules.
10 in an
organization security policy with ID
123456789, run:
gcloud compute org-security-policies rules create 10 --security-policy=123456789 --action=allow --description=example-rule --cloud-armorPRIORITY--action=ACTIONACTION must be one of:
allowdenydeny-403deny-404deny-502goto-nextredirect--security-policy=SECURITY_POLICY--cloud-armor--description=DESCRIPTION--dest-ip-ranges=[DEST_IP_RANGE,…]--direction=DIRECTIONDIRECTION must be one of:
INGRESS, EGRESS.
--[no-]enable-logging--enable-logging to enable and
--no-enable-logging to disable.
--layer4-configs=[LAYER4_CONFIG,…]--organization=ORGANIZATION--preview--target-resources=[TARGET_RESOURCES,…]--target-service-accounts=[TARGET_SERVICE_ACCOUNTS,…]--expression=EXPRESSION--src-ip-ranges=[SRC_IP_RANGE,…]--access-token-file,
--account, --billing-project,
--configuration,
--flags-file,
--flatten, --format, --help, --impersonate-service-account,
--log-http,
--project, --quiet, --trace-token, --user-output-enabled,
--verbosity.
Run $ gcloud help for details.
gcloud alpha compute org-security-policies rules creategcloud beta compute org-security-policies rules creategcloud preview compute org-security-policies rules create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.