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. (ACTIVE, INACTIVE)
systembooleanSpecifies whether Okta created the policy rule (system=true). You can't delete policy rules that have system set to true.
typestringRule type (ACCESS_POLICY, DEVICE_SIGNAL_COLLECTION, ENTITY_RISK, IDP_DISCOVERY, MFA_ENROLL, PASSWORD, POST_AUTH_SESSION, PROFILE_ENROLLMENT, SIGN_ON, SESSION_VIOLATION_DETECTION, CLIENT_UPDATE, IDENTITY_CLAIM_SOURCING)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_policy_ruleselectpolicyId, ruleId, subdomainRetrieves a policy rule
list_policy_rulesselectpolicyId, subdomainlimitLists all policy rules
create_policy_ruleinsertpolicyId, subdomainactivate, limitCreates a policy rule

> Note: You can't create additional rules for the PROFILE_ENROLLMENT, POST_AUTH_SESSION, CLIENT_UPDATE, or <x-lifecycle class="ea"></x-lifecycle> IDENTITY_CLAIM_SOURCING policies.
replace_policy_rulereplacepolicyId, ruleId, subdomainReplaces the properties for a policy rule identified by policyId and ruleId
delete_policy_ruledeletepolicyId, ruleId, subdomainDeletes a policy rule identified by policyId and ruleId
activate_policy_ruleexecpolicyId, ruleId, subdomainActivates a policy rule identified by policyId and ruleId
deactivate_policy_ruleexecpolicyId, ruleId, subdomainDeactivates 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
policyIdstringid of the policy
ruleIdstringid of the policy rule
subdomainstring(default: my-org)
activatestringSet this parameter to false to create an INACTIVE rule.
limitstringDefines the number of policy rules returned. See Pagination.

SELECT examples​

Retrieves a policy rule

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

INSERT examples​

Creates a policy rule

> Note: You can't create additional rules for the PROFILE_ENROLLMENT, POST_AUTH_SESSION, CLIENT_UPDATE, or <x-lifecycle class="ea"></x-lifecycle> IDENTITY_CLAIM_SOURCING policies.

INSERT INTO okta.policies.policy_rules (
name,
priority,
status,
system,
type,
policyId,
subdomain,
activate,
limit
)
SELECT
'{{ name }}',
{{ priority }},
'{{ status }}',
{{ system }},
'{{ type }}',
'{{ policyId }}',
'{{ subdomain }}',
'{{ activate }}',
'{{ limit }}'
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
name = '{{ name }}',
priority = {{ priority }},
status = '{{ status }}',
system = {{ system }},
type = '{{ type }}'
WHERE
policyId = '{{ policyId }}' --required
AND ruleId = '{{ ruleId }}' --required
AND 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 policyId = '{{ policyId }}' --required
AND ruleId = '{{ ruleId }}' --required
AND subdomain = '{{ subdomain }}' --required
;

Lifecycle Methods​

Activates a policy rule identified by policyId and ruleId

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