Comments (9)
an example
https://developer.okta.com/docs/reference/api/groups/#create-group-rule
steps to convert JSON to PowerShell
https://github.com/gabrielsroka/OktaAPI.psm1#converting-json-to-powershell
from oktaapi.psm1.
I've actually been trying to follow the API reference doc from Okta that you linked.
Would you mind pasting a sample of what it would look like in Powershell?
I'm having trouble figuring out where I'm messing up.
from oktaapi.psm1.
Would you share what you've done so far?
from oktaapi.psm1.
Sure.
$value = 'user.ej_location==\"00000000\"'
New-OktaGroupRule @{
type = "group_rule"
name = "TestGroup01Rule"
conditions = @{
people = @{
users = @{
Exclude = ""
}}}
groups = @{
exclude = ""
}
expression = @{
value = $value
type = "urn:oktaexpresssion:1.0"
}
actions = @{
assignUserToGroups =@{
groupIds = @("00g3jzw6uzmhL2ykt297")
}
}
}
from oktaapi.psm1.
here's a functioning (tho not useful) example
btw, you can use triple backticks in GitHub to quote your code
$newRule = ConvertFrom-Json @"
{
"type": "group_rule",
"name": "A PS rule",
"conditions": {
"expression": {
"value": "user.login == Engineer",
"type": "urn:okta:expression:1.0"
}
},
"actions": {
"assignUserToGroups": {
"groupIds": [
"00g10usgcxtVV5CYe0h8"
]
}
}
}
"@
New-OktaGroupRule $newRule
from oktaapi.psm1.
note that JSON is case-sensitive. if Okta wants exclude
, then Exclude
won't work
from oktaapi.psm1.
also, the type
in your example is incorrrect
from oktaapi.psm1.
this example is a little more like yours (you had also misspelled expression
)
i find the indentation to be very helpful
$value = 'user.login == "abc"'
New-OktaGroupRule @{
type = "group_rule"
name = "a ps rule"
conditions = @{
people = @{
users = @{
exclude = @()
}
groups = @{
exclude = @()
}
}
expression = @{
value = $value
type = "urn:okta:expression:1.0"
}
}
actions = @{
assignUserToGroups = @{
groupIds = @("00g3jzw6uzmhL2ykt297")
}
}
}
from oktaapi.psm1.
Ahhh - Both of your most recent responses with code have been incredibly helpful. I thank you.
from oktaapi.psm1.
Related Issues (18)
- (400) Bad Request HOT 3
- Get-OktaUserGroups doesn't support paginated return HOT 2
- License HOT 3
- Invoke-RestMethod 400 Bad Request HOT 1
- Bulk import into Okta HOT 25
- Re-Activate User by ID HOT 1
- Get-OktaUser Exception thrown ?? HOT 6
- Query : What is $group ? OktaAPI.psm1/Modules/OktaAPI.psm1 : Line 82 HOT 3
- Import existing users to single group via CSV? HOT 16
- API key question HOT 6
- Can Fetching limit be increased for Get-OktaUsers Function ? HOT 1
- Using bearer tokens in Connect-Okta HOT 10
- Map existing application and group in okta HOT 1
- Getting next page of logs HOT 1
- Tip for Managing IDs
- New-OktaGroup HOT 4
- Invoke-Webrequest fails on powershell 5 and below on a machine without IE or a user that has never run it HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oktaapi.psm1.