I have two PowerShell Scripts. The one is an initial script which does some work on JSON files and also has some constants in form of an array.
The second one is a function within a separate file.
In my script initial1.ps1
i have the following code:
$IDs=@("02921114-654b-4c28-a9d7-2ebd9ab0ada3",
"9045c61c-55bc-45b0-0000-ec9858b24867",
"011b0c6d-5678-4aaa-a833-e62111103f0a")
. 'D:\...\drop\Add-Folder.ps1' -AdlsAccountName $Accountname `
-PrincipalIds @IDs `
-Path $folderToCreate.path `
-AadGroupName $aadRoleName
My PowerShell script file named 'Add-Folder.ps1` looks like:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string] $AdlsAccountName,
[Parameter(Mandatory=$True,Position=2)]
[string[]] $PrincipalIds,
[Parameter(Mandatory=$True,Position=3)]
[string] $Path,
[Parameter(Mandatory=$True,Position=4)]
[string] $AadGroupName
)
Write-Host "Hello from 'Add-AdlsFolderWithPermissions.ps1'!"
Write-Host $AdlsAccountName
Write-Host $PrincipalIds
Write-Host $Path
Write-Host $AadGroupName
But when i execute it i get the following error:
##[error]A positional parameter cannot be found that accepts argument '9045c61c-55bc-45b0-0000-ec9858b24867'.
Why happens this error or how can i pass the array of IDs to my function?