gcloud alpha resource-manager org-policies set-policy

NAME
gcloud alpha resource-manager org-policies set-policy - set Organization Policy
SYNOPSIS
gcloud alpha resource-manager org-policies set-policyPOLICY_FILE(--folder=FOLDER_ID    |--organization=ORGANIZATION_ID    |--project=PROJECT_ID)[GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) Sets an Organization Policy associated with the specifiedresource from a file that contains the JSON or YAML encoded Organization Policy.
EXAMPLES
Organization policy list constraint YAML file example:
constraint:constraints/CONSTRAINT_NAMElistPolicy:deniedValues:-VALUE_A

Organization policy list constraint JSON file example:

{"constraint":"constraints/CONSTRAINT_NAME","listPolicy":{"deniedValues":["VALUE_A"]}}

The following command sets an Organization Policy for a constraint on projectfoo-project from file/tmp/policy.yaml:

gcloudalpharesource-managerorg-policiesset-policy--project=foo-project/tmp/policy.yaml
POSITIONAL ARGUMENTS
POLICY_FILE
JSON or YAML file with the Organization Policy.
REQUIRED FLAGS
Resource that is associated with the organization policy.

Exactly one of these must be specified:

--folder=FOLDER_ID
Folder ID.
--organization=ORGANIZATION_ID
Organization ID.
--project=PROJECT_ID
Project ID. Overrides the defaultcore/project property value forthis command invocation.
GCLOUD WIDE FLAGS
These flags are available to all commands:--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.

NOTES
This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudresource-managerorg-policiesset-policy
gcloudbetaresource-managerorg-policiesset-policy

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-22 UTC.