connect-msolservice -credentials not working

Welcome Forums General PowerShell Q&A connect-msolservice -credentials not working

  • This topic has 1 reply, 2 voices, and was last updated 1 month ago by
    Senior Moderator
    .
Viewing 1 reply thread
  • Author
    Posts
    • #267665
      Participant
      Topics: 44
      Replies: 97
      Points: 605
      Rank: Major Contributor

      Hi ALl
      I use this code to store my credentials through out the rest of my script this is working just fine.

      however when I use connect-msolservice -credentials $credential I still get the popup to enter my username and password
      when I use Connect-AzureAD -credentials $credential I don’t get the popup window to enter my username and password

      what do I need to do to make sure that the username and password are correctly handled when I connect to msolservice so that I don’t get the popup screen
      thanks for your assistance

      Paul

      • This topic was modified 1 month ago by acer460527. Reason: added working example with connect-azureAD
    • #267713
      Senior Moderator
      Topics: 10
      Replies: 196
      Points: 1,051
      Helping Hand
      Rank: Community Hero

      The expected behavior of Get-Credential is to prompt for username and password (every time). You can use the -Username parameter to pre-fill the username, but you should always be prompted to input your password. It’s possible to create a credential object without prompting the user (as in Example 6) but it requires the password to be stored in a variable as plain text, so probably not a great idea.

      When exactly are you getting the popup? When you run your script, or when you run Connect-MsolService?

      This discussion seems relevant: https://stackoverflow.com/questions/59461216/how-to-use-connect-msolservice-with-automated-credentials
      And apparently the MSOnline module is being deprecated.

      Also, based on the documentation for Connect-MsolService and Connect-AzureAD they have different versions of PowerShell implemented. There may be a difference in the way they’re handled on the server side, and if the MSOnline module is being phased out it may be a problem that never gets fixed.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.