Flow Designer - PowerShell - Different Credentials

TJ29
Tera Contributor

I'm looking to use a custom action in Flow Designer that creates and permissions a network folder using variables passed from the catalog item into the PowerShell script.

New-Item -Path ${project} -ItemType Directory
$NewAcl = Get-Acl -Path ${project}
# Set properties
$identity = ${group}
$fileSystemRights = "Modify"
$type = "Allow"
# Create new rule
$fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
$fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
# Apply new rule
$NewAcl.SetAccessRule($fileSystemAccessRule)
Set-Acl -Path ${project} -AclObject $NewAcl

When I created the action I've defined the PS step Connection Alias as our sn_ad_spoke.AD one since this account has permission to create folders in our desired location. When testing I ran it against a sub-prod file share and it worked as expected. During final stages of testing against the production file share it was throwing back Access Denied despite permissions being fine and the script running in PS direct using the Connection Alias credentials. Turns out the initial tests were running using the MID server service account.

How can I get this action to use specific credentials?

Cheers!

4 REPLIES 4

OlaN
Giga Sage
Giga Sage

Hi,

There is no way to define what user should run a specific Flow action.

A flow action runs with the user as defined by the Flow/subflow calling that action.

TJ29
Tera Contributor

Thanks @OlaN 

I'll raise a HI call since this doesn't seem sensible!

Please report back what answers you get from Now Support (HI).

Is your issue resolved by ServiceNow.