0 Replies · Latest reply on Dec 6, 2017 9:44 AM by Jim Dawson

    Run PowerShell custom activity with alternate credentials

      I need to run a PowerShell script with specific credentials and haven't had much success yet. Here's what I've done so far.


      1. Created an account in AD and assigned it appropriate permissions. Assigned the account log on permissions on two MID servers.
      2. Created a Windows credential object containing the credentials created earlier. Defined a tag for these credentials.
      3. Created a custom PowerShell workflow activity to test
        • Set string input variable of 'host'
        • Set 'Target Host' to '${activityInput.Host}'
        • Entered the following in the 'Command' section: Write-Host "Name: $($cred.username)"
        • Set 'Credential tag' to the same tag specified in credential object.
      4. Set host to the following values and clicked 'Test Inputs',
        • 'blank', 'localhost', and the DNS name of the MID server returned an error of "Failure(s) with available Windows credentials from the instance. Credentials tried: (username from credential object)"
        • '' or the IP address of the local MID server returned no error or text. "NAME: "
        • The DNS name or IP address of the alternate MID server produces the intended output ("NAME: (username from credential object)")


      This is intended to run a script that will need to make calls to Microsoft Azure, the intention is to call 'Add-AzureRmAccount -Credential $cred' to authenticate. I supposed I could specify a designated host that the SN credentials have access to as a workaround but it seems like using credential tagging should be able to address this issue without resorting to this.


      Am I doing something wrong or is this just how credential tagging works with custom activities.


      Thanks in advance.