0

I have a script running under an Azure Automation account. The script connects to the Office 365 endpoint (https://outlook.office365.com/powershell-liveid/), and uses Set-Contact to update some contact information for 5000 contacts (I inherited this so please don't ask :)). The script is running for just over 57 minutes.

The issues I am now starting to get is that 2000 contacts are being updated, then I get the following errors in the logs:

Starting a command on the remote server failed with the following error message : The I/O operation has been aborted because of either a thread exit or an application request. For more information, see the about_Remote_Troubleshooting Help topic.

I get this once, then I get:

Exception calling "GetSteppablePipeline" with "1" argument(s): "Exception calling "PromptForCredential" with "4" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Enter your credentials for https://outlook.office365.com/powershell-liveid/.""

The commands being used to connect are (nothign complicated):

$a = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'https://outlook.office365.com/powershell-liveid/' -Credential $Credential -Authentication Basic -AllowRedirection -Erroraction Stop
Import-PSSession -Session $s -CommandName New-MailContact, Set-Contact, Remove-MailContact -AllowClobber | Out-Null

What it looks like is the remote session is re-requesting login. If that is the case I'm wondering under what circumstances it would do that (for example does the session have a set time and then asks for authentication).

Can anybody shed any light on why this is occurring and what I can do to resolve it?

pauby
  • 121
  • 1
  • 3

1 Answers1

0

Don't ask why, but just delete and import a new session every 50 contacts. I do that to update the picture of +1000 users. And I still get this issue.

I don't think MS want to provide a better solution for massive update.