Skip to content

Commit 9417718

Browse files
committed
Update module
1 parent 714721f commit 9417718

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
Function New-DynamicParameter {
16+
param(
17+
[Parameter(Mandatory = $true, HelpMessage= "Name")]
18+
[string] $Name,
19+
20+
[Parameter(Mandatory = $true, HelpMessage= "Type")]
21+
[type] $Type,
22+
23+
[Parameter(Mandatory = $false, HelpMessage= "Alias")]
24+
[string[]] $Alias,
25+
26+
[Parameter(Mandatory = $false, HelpMessage= "Validate")]
27+
[string[]] $ValidateSet,
28+
29+
[Parameter(Mandatory = $false, HelpMessage= "Validate Script")]
30+
[scriptblock] $ValidateScript
31+
)
32+
33+
$attributes = [System.Collections.ObjectModel.Collection[System.Attribute]]::new()
34+
35+
$paramAttr = [System.Management.Automation.ParameterAttribute]::new()
36+
$paramAttr.Mandatory = $false
37+
$attributes.Add($paramAttr)
38+
39+
If ($Alias) {
40+
$attributes.Add([System.Management.Automation.AliasAttribute]::new($Alias))
41+
}
42+
43+
If ($ValidateSet) {
44+
$attributes.Add([System.Management.Automation.ValidateSetAttribute]::new([string[]]$ValidateSet))
45+
}
46+
47+
If ($ValidateScript) {
48+
$attributes.Add([System.Management.Automation.ValidateScriptAttribute]::new($ValidateScript))
49+
}
50+
51+
[System.Management.Automation.RuntimeDefinedParameter]::new(
52+
$Name,
53+
$Type,
54+
$attributes
55+
)
56+
}

monkey365.psm1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ $sourceFiles = @(
111111
'core/api/entraid/msgraph/helpers/users/Get-MonkeyMSGraphUser.ps1'
112112
'core/api/entraid/msgraph/helpers/groups/Get-MonkeyMSGraphGroup.ps1'
113113
'core/api/entraid/msgraph/helpers/groups/Get-MonkeyMSGraphGroupTransitiveMember.ps1'
114-
'core/api/entraid/msgraph/helpers/serviceprincipals/Get-MonkeyMSGraphServicePrincipal.ps1'
115114
'core/api/entraid/msgraph/helpers/directoryrole/Get-MonkeyMSGraphEntraDirectoryRole.ps1'
116115
'core/api/entraid/msgraph/helpers/directoryrole/Get-MonkeyMSGraphEntraRoleAssignment.ps1'
117116
'core/api/entraid/msgraph/helpers/directoryrole/Get-MonkeyMSGraphObjectDirectoryRole.ps1'

0 commit comments

Comments
 (0)