How to programmatically provide credentials to Get-HPCJob and Stop-HPCJob? RRS feed

  • Question

  • Hello,

    I need to add to our client application the capability to cancel jobs users submit to an HPC cluster on Azure.

    To that end, I tried using the following PowerShell statements, which I call from the C# application:

    Add-PSSnapin Microsoft.HPC Get-HPCJob -Scheduler https://myheadnode.cloudapp.net # Used to get the job ids. Stop-HPCJob -Scheduler https://myheadnode.cloudapp.net -id myJobId

    The problem is that the Get-HPCJob and Stop-HPCJob cmdlets require a set of credentials to be provided by the user, which is not suitable for an unattended usage of those statements.

    Is there a way to programmatically provide credentials to Get-HPCJob and Stop-HPCJob, as I am able to do when creating the Microsoft.HPC.Scheduler.Session object used to submit the jobs to the cluster?

    Thank you.


    Friday, August 5, 2016 7:41 PM

All replies

  • Hi, Marc,

    As this is Azure IaaS cluster, and your client is on premise, you can try the following workaround


    see section "To use HPC Job Manager on the client computer"

    • Proposed as answer by MarcSim Monday, August 8, 2016 1:20 AM
    Monday, August 8, 2016 1:12 AM
  • Hello Yongjun Tian,

    Thank you for your suggestion.

    Earlier today I figured out that the problem likely stemmed from the fact that Get-HPCJob and Stop-HPCJob are meant to be used locally. For my cluster head node located on Azure, I achieved this with the help of the Invoke-Command cmdlet, which accepts a set of credentials, and this resolved my problem.

    However I will also try the solution you proposed.

    Thanks again.


    Monday, August 8, 2016 1:20 AM