Connect to All Microsoft 365 Services

This commit is contained in:
AdminDroid 2025-04-03 18:47:34 +05:30
parent c83cb0c206
commit 13cdc02fb7

View File

@ -2,9 +2,12 @@
============================================================================================= =============================================================================================
Name: Connect to all the Microsoft services using PowerShell Name: Connect to all the Microsoft services using PowerShell
Description: This script automatically installs all the required modules(upon your confirmation) and connects to the services Description: This script automatically installs all the required modules(upon your confirmation) and connects to the services
Version: 4.0 Version: 4.1
Website: o365reports.com Website: o365reports.com
Script Highlights:
~~~~~~~~~~~~~~~~~
1.This script connects to 9 Microsoft 365 services with a single cmdlet. 1.This script connects to 9 Microsoft 365 services with a single cmdlet.
2.Installs Microsoft 365 PowerShell modules. ie, Modules required for Microsoft 365 services are automatically downloaded and installed upon your confirmation. 2.Installs Microsoft 365 PowerShell modules. ie, Modules required for Microsoft 365 services are automatically downloaded and installed upon your confirmation.
3.You can connect to one or more Microsoft 365 services via PowerShell using a single cmdlet. 3.You can connect to one or more Microsoft 365 services via PowerShell using a single cmdlet.
@ -15,6 +18,16 @@ Website: o365reports.com
7.The script supports Certificate-Based Authentication (CBA) too. 7.The script supports Certificate-Based Authentication (CBA) too.
For detailed script execution: https://o365reports.com/2019/10/05/connect-all-office-365-services-powershell/ For detailed script execution: https://o365reports.com/2019/10/05/connect-all-office-365-services-powershell/
Change Log:
~~~~~~~~~~~
~~~~~~~~~
V1.0 (Nov 01, 2019) - File created
V2.0 (Jan 21, 2020) - Added support for MS Online and SharePoint PnP PowerShell modules
V3.0 (Oct 06, 2023) - Removed Skype for Business and minor usability changes
V4.0 (Feb 29, 2024) - Added support for MS Graph and MS Graph beta PowerShell modules
V4.1 (Apr 03, 2025) - Handled ClientId requirement for SharePoint PnP PowerShell module
============================================================================================ ============================================================================================
#> #>
Param Param
@ -288,10 +301,15 @@ else
$SharePointHostName= Read-Host "Please enter SharePoint organization name" $SharePointHostName= Read-Host "Please enter SharePoint organization name"
} }
if($AppId -eq "")
{
Write-Host `nClient Id is mandatory to connect SharePoint PnP PowerShell -ForegroundColor Yellow
$AppId= Read-Host "Please enter client id to connect PnP PowerShell"
}
if($CredentialPassed -eq $true) if($CredentialPassed -eq $true)
{ {
Connect-PnPOnline -Url https://$SharePointHostName-admin.sharepoint.com -credential $credential -WarningAction Ignore Connect-PnPOnline -Url https://$SharePointHostName-admin.sharepoint.com -credential $credential -ClientId $AppId -WarningAction Ignore
} }
elseif($CBA -eq $true) elseif($CBA -eq $true)
{ {
@ -305,7 +323,7 @@ else
else else
{ {
Connect-PnPOnline -Url https://$SharePointHostName-admin.sharepoint.com -WarningAction Ignore -Interactive Connect-PnPOnline -Url https://$SharePointHostName-admin.sharepoint.com -ClientId $AppId -WarningAction Ignore -Interactive
} }
If ($? -eq $true) If ($? -eq $true)
{ {