Connect to Office 365/Azure AD through PowerShell

PowerShell is something you will need to get familiar with in order to be an efficient Office 365 administrator. In fact some tasks can only be done through PowerShell and a lot of bulk tasks are just a pain in the ass to do manually. This post will guide you through the installation of the prerequisites and how to connect to the Office 365 tenant.

PowerShell

You will be prompted for your credentials. Type in the username and password for a global administrator in the tenant you want to connect to. That’s it. To verify that you are connected run the command Get-MsolUser and see that the users in the tenant are returned in the PowerShell window.

If you for some reason should not be connected it is either because one of the installations above failed or that the PowerShell module is not loaded in your PowerShell session. To manually load the PowerShell module, put the following line at the top of your script.