Skip to main content

policy_rules

Creates, updates, deletes, gets or lists a policy_rules resource.

Overview

Namepolicy_rules
TypeResource
Idokta.policies.policy_rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringIdentifier for the rule
namestringName of the rule
_linksobject
createdstring (date-time)Timestamp when the rule was created
lastUpdatedstring (date-time)Timestamp when the rule was last modified
priorityintegerPriority of the rule
statusstringWhether or not the rule is active. Use the activate query parameter to set the status of a rule.
systembooleanSpecifies whether Okta created the policy rule (system=true). You can't delete policy rules that have system set to true.
typestringRule type

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_policy_rulesselectsubdomainLists all policy rules
get_policy_ruleselectsubdomainRetrieves a policy rule
create_policy_ruleinsertsubdomainactivateCreates a policy rule

> Note: You can't create additional rules for the PROFILE_ENROLLMENT or POST_AUTH_SESSION policies.
replace_policy_rulereplacesubdomainReplaces the properties for a policy rule identified by policyId and ruleId
delete_policy_ruledeletesubdomainDeletes a policy rule identified by policyId and ruleId
activate_policy_ruleexecsubdomainActivates a policy rule identified by policyId and ruleId
deactivate_policy_ruleexecsubdomainDeactivates a policy rule identified by policyId and ruleId

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
subdomainstringThe domain of your organization. This can be a provided subdomain of an official okta domain (okta.com, oktapreview.com, etc) or one of your configured custom domains. (default: my-org)
activatebooleanSet this parameter to false to create an INACTIVE rule.

SELECT examples

Lists all policy rules

SELECT
id,
name,
_links,
created,
lastUpdated,
priority,
status,
system,
type
FROM okta.policies.policy_rules
WHERE subdomain = '{{ subdomain }}' -- required
;

INSERT examples

Creates a policy rule

> Note: You can't create additional rules for the PROFILE_ENROLLMENT or POST_AUTH_SESSION policies.

INSERT INTO okta.policies.policy_rules (
data__name,
data__priority,
data__status,
data__system,
data__type,
subdomain,
activate
)
SELECT
'{{ name }}',
{{ priority }},
'{{ status }}',
{{ system }},
'{{ type }}',
'{{ subdomain }}',
'{{ activate }}'
RETURNING
id,
name,
_links,
created,
lastUpdated,
priority,
status,
system,
type
;

REPLACE examples

Replaces the properties for a policy rule identified by policyId and ruleId

REPLACE okta.policies.policy_rules
SET
data__name = '{{ name }}',
data__priority = {{ priority }},
data__status = '{{ status }}',
data__system = {{ system }},
data__type = '{{ type }}'
WHERE
subdomain = '{{ subdomain }}' --required
RETURNING
id,
name,
_links,
created,
lastUpdated,
priority,
status,
system,
type
;

DELETE examples

Deletes a policy rule identified by policyId and ruleId

DELETE FROM okta.policies.policy_rules
WHERE subdomain = '{{ subdomain }}' --required
;

Lifecycle Methods

Activates a policy rule identified by policyId and ruleId

EXEC okta.policies.policy_rules.activate_policy_rule 
@subdomain='{{ subdomain }}' --required
;