Introduction to SharePoint Online Management Shell (.NET Core Version)

The SharePoint Online Management Shell with .NET Core provides a modern, cross-platform experience for administrators who need to manage SharePoint Online environments. By leveraging the power of PowerShell Core and .NET Core, this version can be installed and run on Windows, macOS, and Linux, giving administrators more flexibility and portability.

What is SharePoint Online Management Shell (.NET Core)?

SharePoint Online Management Shell is a command-line tool that includes a set of PowerShell cmdlets specifically designed for managing SharePoint Online environments. With the .NET Core version, administrators can run the tool on a broader range of operating systems, and enjoy enhanced compatibility with modern development environments. This tool is essential for automating administrative tasks such as managing users, sites, and permissions.

Key Features of SharePoint Online Management Shell (.NET Core)

  • Cross-Platform: Compatible with Windows, macOS, and Linux systems.
  • Automation: Automate repetitive or complex tasks across different environments.
  • Performance: Leverages .NET Core for better performance and portability.
  • Modern Development: Supports integration with modern DevOps pipelines and workflows.
  • Bulk Management: Manage sites, users, and permissions in bulk via cmdlets.

Installing SharePoint Online Management Shell on .NET Core

To use SharePoint Online Management Shell with .NET Core, you’ll need to have PowerShell Core installed. Follow the steps below based on your operating system.

Prerequisites

  1. PowerShell Core (7.x): The SharePoint Online Management Shell is compatible with PowerShell 7.x, which is the version based on .NET Core.
  2. .NET Core Runtime: Make sure you have the .NET Core runtime installed. Instructions for different platforms are provided below.
  3. Administrator Role: You must be a Global Administrator or SharePoint Administrator to manage SharePoint Online environments.

Step 1: Install PowerShell Core (If Not Installed)

  • Windows:
    Download and install PowerShell Core from the official GitHub page. After installation, verify the version by running:
  pwsh -Version
  • macOS:
    Use Homebrew to install PowerShell Core:
  brew install --cask powershell

After installation, start PowerShell by typing pwsh in the terminal.

  • Linux (Ubuntu example):
    Install PowerShell Core via apt:
  sudo apt-get update
  sudo apt-get install -y powershell

Launch PowerShell with the pwsh command.

Step 2: Install the SharePoint Online Management Shell Module

Once PowerShell Core is installed, you can install the SharePoint Online Management Shell module using the Install-Module cmdlet:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -AllowClobber
  • The -AllowClobber flag is used in case other modules with the same cmdlet names exist.
  • You may be prompted to install the NuGet provider the first time, so accept any prompts.

Step 3: Verifying the Installation

To ensure that the SharePoint Online Management Shell module is installed correctly, run:

Get-Module -ListAvailable -Name Microsoft.Online.SharePoint.PowerShell

This command should return details of the installed module, confirming that it is ready to use.

Connecting to SharePoint Online

Before executing any administrative tasks, you need to authenticate and connect to your SharePoint Online tenant.

Connect to the Tenant

  1. Open PowerShell Core.
  2. Run the following command to connect to your tenant:
   Connect-SPOService -Url https://<your-tenant-name>-admin.sharepoint.com
  1. Provide your Global Administrator or SharePoint Administrator credentials when prompted.

Once authenticated, you’re connected to your SharePoint Online admin center and can start managing your environment.

Common Cmdlets for Managing SharePoint Online

Here are some of the key cmdlets you can use after connecting to your SharePoint Online tenant:

1. Site Collection Management

  • Create a new site collection:
  New-SPOSite -Url https://<your-tenant-name>.sharepoint.com/sites/sitename -Owner user@domain.com -StorageQuota 1024 -Title "Site Title"
  • Delete a site collection:
  Remove-SPOSite -Identity https://<your-tenant-name>.sharepoint.com/sites/sitename

2. User Management

  • Assign a site collection administrator:
  Set-SPOUser -Site https://<your-tenant-name>.sharepoint.com/sites/sitename -LoginName user@domain.com -IsSiteCollectionAdmin $true
  • Remove a user:
  Remove-SPOUser -Site https://<your-tenant-name>.sharepoint.com/sites/sitename -LoginName user@domain.com

3. Permissions Management

  • List all users in a site collection:
  Get-SPOUser -Site https://<your-tenant-name>.sharepoint.com/sites/sitename
  • View storage quota information:
  Get-SPOSite -Identity https://<your-tenant-name>.sharepoint.com/sites/sitename -Detailed

Troubleshooting and Known Issues

  1. Installation Failures:
  • Ensure that you have PowerShell Core (7.x) installed.
  • Make sure your system has the latest version of the .NET Core runtime.
  1. Cannot Connect to Tenant:
  • Double-check the tenant URL and ensure your account has the necessary admin privileges.
  • Ensure you are using the correct cmdlet (Connect-SPOService) and authenticating with the proper credentials.
  1. Command Errors:
  • Verify that the correct module is installed by running Get-Module -ListAvailable -Name Microsoft.Online.SharePoint.PowerShell.
  • If you encounter issues with cmdlets, make sure you are using the latest version of the module by running: Update-Module -Name Microsoft.Online.SharePoint.PowerShell

Advantages of Using the .NET Core Version

  • Cross-Platform Support: Run the SharePoint Online Management Shell on any modern OS.
  • Lightweight: The .NET Core runtime is smaller and faster, leading to better performance in many environments.
  • Modern Development: Leverage the latest technologies in DevOps and automation with .NET Core.
  • Better Compatibility: Works with modern tools and pipelines, especially for cloud-native or hybrid environments.

Conclusion

The SharePoint Online Management Shell with .NET Core offers a versatile, high-performance tool for SharePoint Online administrators who need flexibility in their environment. By supporting a cross-platform experience, it enables administrators to manage their environments from any operating system. Whether you’re on Windows, macOS, or Linux, you can leverage the power of automation to simplify your SharePoint Online management tasks.


Summary of Cmdlets Used in This Article:

CmdletDescription
Install-Module -Name Microsoft.Online.SharePoint.PowerShell -AllowClobberInstalls the SharePoint Online Management Shell module.
Connect-SPOService -UrlConnects to the SharePoint Online tenant.
New-SPOSite -UrlCreates a new site collection.
Remove-SPOSite -IdentityRemoves a site collection.
Set-SPOUser -SiteAssigns a user as a site collection admin.
Remove-SPOUser -SiteRemoves a user from a site collection.
Get-SPOUser -SiteLists all users in a site collection.
Get-SPOSite -Identity -DetailedRetrieves detailed information about a site collection.
Edvaldo Guimrães Filho Avatar

Published by

Categories:

Leave a comment