Public/Add-AllegisIDNaccessProfile.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
function Add-AllegisIDNaccessProfile ($orgName,$accessToken,$APName,[string[]]$Entitlements,$SourceID,$OwnerID,$ApprovalSchemes,$requestCommentsRequired,$deniedCommentsRequired ){
    $header=get-AllegisIDNprivateHeader $accessToken
    $url="https://$orgname.api.identitynow.com/v2/access-profiles"
    $body="{
""name"": ""$APName"",
""description"": """",
""sourceId"": ""$SourceID"",
""ownerId"": ""$OwnerID"",
""entitlements"": [
        "
     
    for ($i=0;$i-lt$Entitlements.count;$i++){
        [string]$entitlementsBody+='"'+ $($entitlements[$i])+'"'+", "
    }
    $entitlementsBody=$entitlementsBody.trimEnd(", ")
    $body+="$($entitlementsBody)
        ],
    ""approvalSchemes"": ""$approvalSchemes"",
    ""requestCommentsRequired"": $($requestCommentsRequired),
    ""deniedCommentsRequired"": $($deniedCommentsRequired)
    }"

   
        #$body
    $response=Invoke-WebRequest -usebasicparsing -Uri $url -Method Post -Headers $header -Body $body
}