-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from kayasax/reporting
V1.6.3
- Loading branch information
Showing
9 changed files
with
284 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
EasyPIM/internal/functions/Set-ActiveAssignmentRequirement.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<# | ||
.Synopsis | ||
Rule for active assignment requirement | ||
.Description | ||
rule 2 in https://learn.microsoft.com/en-us/graph/identity-governance-pim-rules-overview#activation-rules | ||
.Parameter ActiveAssignmentRequirement | ||
value can be "None", or one or more value from "Justification","MultiFactoAuthentication" | ||
WARNING options are case sensitive! | ||
.EXAMPLE | ||
PS> Set-ActiveAssignmentRequirement "Justification" | ||
A justification will be required to activate the role | ||
.Link | ||
.Notes | ||
#> | ||
function Set-ActiveAssignmentRequirement($ActiveAssignmentRequirement, [switch]$entraRole) { | ||
write-verbose "Set-ActiveAssignmentRequirementt : $($ActiveAssignmentRequirement.length)" | ||
if (($ActiveAssignmentRequirement -eq "None") -or ($ActiveAssignmentRequirement[0].length -eq 0 )) { | ||
#if none or a null array | ||
write-verbose "requirement is null" | ||
$enabledRules = "[]," | ||
} | ||
else { | ||
write-verbose "requirement is NOT null" | ||
$formatedRules = '[' | ||
|
||
$ActiveAssignmentRequirement | ForEach-Object { | ||
$formatedRules += '"' | ||
$formatedRules += "$_" | ||
$formatedRules += '",' | ||
} | ||
#remove last comma | ||
$formatedRules = $formatedRules -replace “.$” | ||
|
||
$formatedRules += "]," | ||
$enabledRules = $formatedRules | ||
#Write-Verbose "************* $enabledRules " | ||
} | ||
|
||
$properties = '{ | ||
"enabledRules": '+ $enabledRules + ' | ||
"id": "Enablement_Admin_Assignment", | ||
"ruleType": "RoleManagementPolicyEnablementRule", | ||
"target": { | ||
"caller": "Admin", | ||
"operations": [ | ||
"All" | ||
], | ||
"level": "Assignment", | ||
"targetObjects": [], | ||
"inheritableSettings": [], | ||
"enforcedSettings": [] | ||
} | ||
}' | ||
if ($entraRole) { | ||
$properties = ' | ||
{ | ||
"@odata.type" : "#microsoft.graph.unifiedRoleManagementPolicyEnablementRule", | ||
"enabledRules": '+ $enabledRules + ' | ||
"id": "Enablement_Admin_Assignment", | ||
"target": { | ||
"caller": "EndUser", | ||
"operations": [ | ||
"All" | ||
], | ||
"level": "Assignment", | ||
"inheritableSettings": [], | ||
"enforcedSettings": [] | ||
} | ||
}' | ||
} | ||
return $properties | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<# | ||
.Synopsis | ||
Rule for authentication context | ||
.Description | ||
rule 3 in https://learn.microsoft.com/en-us/graph/identity-governance-pim-rules-overview#activation-rules | ||
.Parameter AuthenticationContext_Enabled | ||
$true or $false | ||
.PARAMETER AuthenticationContext_Value | ||
authentication context name ex "c1" | ||
.PARAMETER entraRole | ||
$true or $false | ||
.EXAMPLE | ||
PS> Set-AuthenticationContext -authenticationContext_Enabled $true -authenticationContext_Value "c1" | ||
Authentication context c1 will be required to activate the role | ||
.Link | ||
.Notes | ||
#> | ||
function Set-AuthenticationContext($authenticationContext_Enabled, $authenticationContext_Value, [switch]$entraRole) { | ||
write-verbose "Set-AuthenticationContext : $($authenticationContext_Enabled), $($authenticationContext_Value)" | ||
|
||
|
||
|
||
if ($true -eq $authenticationContext_Enabled) { | ||
$enabled = "true" | ||
if ($authenticationContext_Value -eq "None" -or $authenticationContext_Value.length -eq 0) { | ||
Throw "AuthenticationContext_Value cannot be null or empty if AuthenticationContext_Enabled is true" | ||
} | ||
if ( ([regex]::match($authenticationContext_Value, "c[0-9]{1,2}$").success -eq $false)) { | ||
Throw "AuthenticationContext_Value must be in the format c1 - c99" | ||
} | ||
} | ||
else { $enabled = "false" } | ||
|
||
$properties = '{ | ||
"id": "AuthenticationContext_EndUser_Assignment", | ||
"ruleType": "RoleManagementPolicyAuthenticationContextRule", | ||
"isEnabled": '+ $enabled + ', | ||
"claimValue": "'+ $authenticationContext_Value + '", | ||
"target": { | ||
"caller": "EndUser", | ||
"operations": [ | ||
"All" | ||
], | ||
"level": "Assignment" | ||
} | ||
}' | ||
|
||
if ($entraRole) { | ||
$properties = ' | ||
{ | ||
"@odata.type": "#microsoft.graph.unifiedRoleManagementPolicyAuthenticationContextRule", | ||
"id": "AuthenticationContext_EndUser_Assignment", | ||
"isEnabled": '+ $enabled + ', | ||
"claimValue": "'+ $authenticationContext_Value + '", | ||
"target": { | ||
"caller": "EndUser", | ||
"operations": [ | ||
"all" | ||
], | ||
"level": "Assignment", | ||
"inheritableSettings": [], | ||
"enforcedSettings": [] | ||
} | ||
}' | ||
} | ||
return $properties | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.