0 votes

I am trying to automate some of my o365 scripts so that the helpdesk can run them with elevated permissions and not have that access directly in o365. How do I create a powershell session, automatically passing the 'Run As' Adaxes service account that the custom command is using?

This is what I have so far, but it errors out.

In the powershell script editor it gives me an error 'Cannot process argument transformation on parameter 'Credential'. A command that prompts the user failed because the host program or the command type does not support user interaction.

If I add this custom powershell command to my admin web portal, it errors with:
[ClientAccessServer=MWHPR03CA0014,BackEndServer=,RequestId=9f048b98-c830-4bef-832f-b24b0bf672f5,TimeStamp=11/23/2018 5:20:55 PM] [FailureCategory=LiveID-InvalidCreds]

#Connect to Office 365/MSOL
$o365Credentials = $Context.GetOffice365Credential()
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $o365Credentials -Authentication Basic -AllowRedirection
Import-PSSession $session -AllowClobber -DisableNameChecking

by (430 points)

1 Answer

0 votes
by (430 points)
selected by
Best answer

This can be disregarded. I believe my issue was with the 'Cloud Services / Office 365' settings. I adjusted my associated active directory scope and I am able to connect to o365 and MSOL now.

Related questions

0 votes
1 answer

Is it possible to connect to the Microsoft 365 Security & Compliance center through a PowerShell script? We are trying to configure users that belong to a ... department for a retention policy through the use of the Set-RetentionCompliancePolicy command.

asked Jan 3, 2022 by scoutcor (120 points)
0 votes
1 answer

Hi, We encounter an error on one of our Adaxes service (Adaxes 2016 3.7.13430) when activating Licence for new user : Softerra.Adaxes.CommandPipeline.CommandProcessingException: The ... stack trace --- Any idea ? Thank you in advance for your help regards

asked Sep 20, 2017 by smasset (740 points)
0 votes
1 answer

I am getting the following error within Adaxes when I try to connect to my Office 365 tenant or run any powershell scripts against it. Failed to create an Office ... .Runspaces.InitialSessionState' threw an exception. Does anybody have a solution for this :?:

asked Jun 17, 2015 by rmedeiros (380 points)
0 votes
1 answer

what version of powershell is needed with modern auth and connect to 0365/azure

asked Sep 30, 2022 by sra98a (120 points)
0 votes
1 answer

I would like to know how to connect to Azure AD using Adaxes. I've already followed the instructions to connect to AAD using an application ID for Adaxes, but how can I ... place as the script is executed, much like what you see in a normal Powershell command?

asked Sep 2, 2022 by andreashalkias (50 points)
3,588 questions
3,277 answers
8,303 comments
548,089 users