Hi all,
I am getting a weird error when updating insight from Azure AD, even though the records are being updated I am getting an error. This error is impacting when I find a matching record also (based on a name).
Here is the error
Invoke-RestMethod : {"errorMessages":["IQL \"Name = Lee Gu\" has invalid syntax at position 11 with error message \"mismatched input 'G' expecting {, '
'}\""],"errors":{}}
At C:\Users\Steven-Admin\Desktop\AddToInsight.ps1:138 char:15
+ ... $result = Invoke-RestMethod -Method Post -Headers $headers -Uri $ur ...
Here is what is getting logged
[2022-09-15 15:44:08] Name = Lee Gu
[2022-09-15 15:44:08] {
"objectSchemaId": 5,
"objectTypeId": 24,
"resultsPerPage": 1,
"iql": "Name = Lee Gu"
}
Here is what I see when I check the data variable
PS C:\Windows\system32> $data
AD_Name AD_Country
------- ----------
@{name=Name; id=99; value=Lee Gu} @{name=Country; id=448; value=United States}
I am assuming this part if what is wrong, but not sure how to fix it
"Name = Lee Gu"
I am building the IQL like this
$key = $data.AD_Name
$iql = $key.name + ' = ' + $key.value
$url = "https://api.atlassian.com/jsm/insight/workspace/$workspaceId/v1/object/navlist/iql"
$headers = @{
'Authorization' = "Basic $token"
'Content-Type' = 'application/json'
'Accept' = 'application/json'
}
$resultsPerPage = 1
$body = [PSCustomObject]@{
objectSchemaId = $objectSchemaId
objectTypeId = $objectTypeId
resultsPerPage = $resultsPerPage
iql = $iql
} | ConvertTo-Json
$result = Invoke-RestMethod -Method Post -Headers $headers -Uri $url -Body $body
Not sure how to fix this
Azure AD has a unique ID field.. no spaces, so no problem. Insight is getting new users created from Azure and updating information for existing users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.