none
Trouble connecting to Exchange and Sharepoint RRS feed

  • Question

  • Hello, I got setup with an Azure automation account and now I'm trying to run stuff here.

    Connecting to Exchange results in an error. I downloaded the ExchangeOnlineShell-module in the account, and this module works fine from my local client.

    In Azure automation, testing the code to connect:

    $PSCred = Get-AutomationPSCredential -Name 'PowershellTest'
    Connect-ExchangeOnlineShell -Credential $PSCred

    results in error:

    Connect-ExchangeOnlineShell : Catched Exception: AADSTS50126: Invalid username or password.

    (Testing with a simple command to connect to sharepoint and list our sites works fine, so I know the credentials are ok.)

    But it's the exchange connect we need...Any ideas?


    • Edited by GonWild Thursday, October 10, 2019 8:45 AM
    Monday, October 7, 2019 8:53 AM

All replies

  • Also...

    Testing with a few other cmdlets. I have 2 test users/credentials. User1, User2 - Both global admin.

    Connect-AzureAD: Works with both

    Connect-SPOService: works only with User1

    Connect-ExchangeOnlineShell: Works only for User2 (didn't work for any of the users a few days ago. Hence my problem above.)

    Why is this thing so unstable? Have I missed something? Is there a better way to connect to these services in the runbooks?

    Thursday, October 10, 2019 7:53 AM