Skip to content

Commit d0949ed

Browse files
stevemutungiKenitoInc
authored andcommitted
End of milestone checkin
1 parent bc97229 commit d0949ed

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

module/Entra/Microsoft.Entra/Governance/Set-EntraAppRoleToApplicationUser.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ function Set-EntraAppRoleToApplicationUser {
99
HelpMessage = "Specify the data source type: 'DatabaseorDirectory', 'SAPCloudIdentity', or 'Generic' which determines the column attribute mapping.",
1010
ParameterSetName = 'Default')]
1111
[Parameter(Mandatory = $true, ParameterSetName = 'ExportResults')]
12+
[Parameter(Mandatory = $true, ParameterSetName = 'ValidateAction')]
1213
[ValidateSet("DatabaseorDirectory", "SAPCloudIdentity", "Generic")]
1314
[string]$DataSource,
1415

1516
[Parameter(Mandatory = $true,
1617
HelpMessage = "Path to the input file containing users, e.g., C:\temp\users.csv",
1718
ParameterSetName = 'Default')]
1819
[Parameter(Mandatory = $true, ParameterSetName = 'ExportResults')]
20+
[Parameter(Mandatory = $true, ParameterSetName = 'ValidateAction')]
1921
[ValidateNotNullOrEmpty()]
2022
[ValidateScript({ Test-Path $_ })]
2123
[System.IO.FileInfo]$FileName,
@@ -24,6 +26,7 @@ function Set-EntraAppRoleToApplicationUser {
2426
HelpMessage = "Name of the application (Service Principal) to assign roles for",
2527
ParameterSetName = 'Default')]
2628
[Parameter(Mandatory = $true, ParameterSetName = 'ExportResults')]
29+
[Parameter(Mandatory = $true, ParameterSetName = 'ValidateAction')]
2730
[ValidateNotNullOrEmpty()]
2831
[string]$ApplicationName,
2932

@@ -34,7 +37,10 @@ function Set-EntraAppRoleToApplicationUser {
3437

3538
[Parameter(Mandatory = $false, ParameterSetName = 'ExportResults',
3639
HelpMessage = "Path for the export file. Defaults to current directory.")]
37-
[System.IO.FileInfo]$ExportFileName = (Join-Path (Get-Location) "EntraAppRoleAssignments_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv")
40+
[System.IO.FileInfo]$ExportFileName = (Join-Path (Get-Location) "EntraAppRoleAssignments_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv"),
41+
42+
[Parameter(Mandatory = $false, ParameterSetName = 'ValidateAction')]
43+
[switch]$Validate
3844
)
3945

4046
process {
@@ -130,6 +136,7 @@ function Set-EntraAppRoleToApplicationUser {
130136
}
131137

132138
$newApp = New-EntraApplication @appParams
139+
$validationStatus += "New application will be created with displayName - '$DisplayName'"
133140
Write-ColoredVerbose "Created new application: $DisplayName"
134141

135142
# Create service principal for the application
@@ -320,6 +327,7 @@ function Set-EntraAppRoleToApplicationUser {
320327
function StartOrchestration {
321328

322329
try {
330+
$validationStatus = @()
323331
# Import users from the CSV file
324332
Write-ColoredVerbose "Importing users from file: $FileName" -Color "Cyan"
325333
$users = Import-Csv -Path $FileName

0 commit comments

Comments
 (0)