, , , ,

Office 365 – How to connect with Powershell

1–2 minutes
6 comments on Office 365 – How to connect with Powershell
office365 powershell

In Office 365 you can do and automate a lot with Windows Powershell. Now this small post shows you how you can connect to Office 365 with Powershell.

  1. Install the Microsoft Online Services Sign-In Assistant
    32-bit
    64-bit
  2. Install the Microsoft Online Services Module for Windows PowerShell
    32-bit
    64-bit
  3. Open Powershell and import the MsOnline Module or use the desktop shortcut which was created by the installer.
    Import-Module MsOnline
  4. Connect to your Microsoft Office 365 account
    Connect-MsolService

    Use your Office 365 LiveID to login (for example [email protected])

  5. Now you can start working with Windows Powershell in your Office 365 account, if you need some more help about the available Powershell cmdlets you can list them with
    Get-Command -Module MsOnline

6 responses

  1. Joe Avatar

    Fails. “In order to install Windows Azure Active Directory Module for Windows PowerShell, you must have Microsoft Online Services Sign-in Assistant version 7.0 or greater installed on this computer.” Yeah, I do. Rebooted. It’s all there. Microsoft isn’t.

  2. Tom Avatar

    Same here. Just use this link for the first download then reboot and come back to install the second plugin.
    https://www.microsoft.com/en-us/download/confirmation.aspx?id=28177

  3. Scott Shanks Avatar
    Scott Shanks

    Hey Thomas,
    I found this page as a result of trying to amend adhocsubscription settings on my new GoDaddy account, so I can setup my Power BI login.
    https://powerbi.microsoft.com/en-us/blog/ability-to-disable-free-sign-ups-for-the-free-power-bi/

    It seems that this is deprecated and on a new module now?
    I was enthusiastic when I found your page, but didn’t notice it was old.

    Do you know if the above approach still applies or do I need to move onto the Azure Active Directory PowerShell for Graph module? I’ve tried this but am getting lost in PowerShell and Azure Portal.

    Thanks

    Scott

    1. Thomas Maurer Avatar

      The new Module is the AzureAD module you can use, that is the new one :)
      Install-Module AzureAD

  4. Scott Shanks Avatar
    Scott Shanks

    Hi Thomas,

    Many thanks for the super quick response.

    I managed to do that earlier in the Windows PowerShell as an Administrator, but got stuck not knowing if its the right route.

    All I then (apparently) needed to do in the MSONline module was:
    Set-MsolCompanySettings -AllowAdHocSubscriptions $true

    I’ve just done the following again in the Windows PowerShell and see loads of CmdLets, but cannot find any equivalent to the above AllowAsHocSubscriptions or *Company* or *Subscriptions*
    Get-Command -Module AzureAD

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.