How to Administer client Office 365 accounts via PowerShell

Iron Contributor



I'd like to be able to manage all of our client Office 365 tenants via PowerShell.


However when I try to login to PowerShell using the global admin account credentials, this does not allow me to login to PowerShell.


What's the best wasy for me to do what I'm trying to do?

2 Replies



We need to know a little more details, such as the error you are getting, what command you have tried, etc.  There is a little setup required such as installing WIndows Framework 4.0 or 5.0, installing the Microsoft Sign-on assistant, etc.  Here are some references to what you need to do:



You can try this code, it works for me : 


Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session