Az Module - Retrieve credential user name and password (Azure Automation) RRS feed

  • Question

  • Hi all,

    I am creating a PowerShell runbook to run an Azure Data Factory (ADF) pipeline. For this, I have to make a connection first using the Connect-AzAccount command (Az Module).

    With the "old" Azure Rm Module, the following (command Get-AutomationPSCredential) works to retrieve the user name and password from the credential:

    $myCred = Get-AutomationPSCredential -Name 'MyCredential`

    $userName = $myCred.UserName

    $securePassword = $myCred.Password

    $password = $myCred.GetNetworkCredential().Password

    $myPsCred = New-Object System.Management.Automation.PSCredential ($userName,$password)

    Connect-AzureRmAccount -Credential $myPsCred

    I tried the Get-AzAutomationCredential command, but this does not return the credential user name and password. Can anyone help me with this?

    Thank you in advance!

    Kind regards,

    Friday, May 10, 2019 2:00 PM

All replies

  • The Get-AzAutomationCredential cmdlet gets one or more Azure Automation credentials. By default, all credentials are returned. Specify the name of a credential to get a specific credential. For security purposes, this cmdlet does not return credential passwords.
    $myCred = Get-AutomationPSCredential -Name 'MyCredential'
    Connect-AzAccount -Credential $myCred

    • Edited by Hari VS_Kid Saturday, May 11, 2019 1:33 AM Formatting
    Saturday, May 11, 2019 1:32 AM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,


    Just do it.

    Friday, May 31, 2019 7:56 AM
  • Just checking to see if the response was helpful, if not please comment on the thread so that we can assist further.

    Please remember to mark the replies as answers if they help.
    Tuesday, June 4, 2019 8:39 AM