Public/new-AllegisIDNIdentityAttribute.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function new-AllegisIDNIdentityAttribute ($orgName, $accessToken, $name){
    $header=get-AllegisIDNprivateHeader $accessToken
    $header+=@{'Content-Type'='application/json'}
    $privateuribase="https://$orgname.identitynow.com"
    $url="$privateuribase/cc/api/identityAttribute/create"
    $TextInfo = (Get-Culture).TextInfo
    $sysname=$TextInfo.ToTitleCase($name).replace(' ','')
    $sysname=$sysname.ToLower()[0] + $sysname.Substring(1)
    $body="{
    ""name"": ""$sysname"",
    ""multiValued"": false,
    ""namedColumn"": false,
    ""searchable"": false,
    ""silent"": false,
    ""sources"": [{
        ""properties"": {
            ""ruleName"": ""Cloud Promote Identity Attribute""
        },
        ""type"": ""rule""
    }],
    ""standard"": false,
    ""system"": false,
    ""type"": ""string"",
    ""displayName"": ""$name""
}"

    $response=Invoke-WebRequest -Uri $url -Method Post -UseBasicParsing -Headers $header -Body $body
    $sourceIdentityProfile=$response.Content | ConvertFrom-Json
    return $sourceIdentityProfile
}