From b564458ed1ca4020b9ec572cb6bf10e19e3e531a Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Sun, 23 Jun 2024 12:31:35 -0500 Subject: [PATCH] fix: Removed banner fix and included AzureAD --- source/Private/Connect-M365Suite.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/Private/Connect-M365Suite.ps1 b/source/Private/Connect-M365Suite.ps1 index 741444c..61f372c 100644 --- a/source/Private/Connect-M365Suite.ps1 +++ b/source/Private/Connect-M365Suite.ps1 @@ -18,9 +18,9 @@ function Connect-M365Suite { try { if ($RequiredConnections -contains "AzureAD" -or $RequiredConnections -contains "AzureAD | EXO" -or $RequiredConnections -contains "AzureAD | EXO | Microsoft Graph") { - Write-Host "Connecting to Azure Active Directory..." -ForegroundColor Cyan - Connect-AzureAD | Out-Null - $tenantDetails = Get-AzureADTenantDetail + Write-Host "Connecting to Azure Active Directory..." -ForegroundColor Yellow + Connect-AzureAD -WarningAction SilentlyContinue | Out-Null + $tenantDetails = Get-AzureADTenantDetail -WarningAction SilentlyContinue $tenantInfo += [PSCustomObject]@{ Service = "Azure Active Directory" TenantName = $tenantDetails.DisplayName @@ -31,7 +31,7 @@ function Connect-M365Suite { } if ($RequiredConnections -contains "Microsoft Graph" -or $RequiredConnections -contains "EXO | Microsoft Graph") { - Write-Host "Connecting to Microsoft Graph with scopes: Directory.Read.All, Domain.Read.All, Policy.Read.All, Organization.Read.All" -ForegroundColor Cyan + Write-Host "Connecting to Microsoft Graph with scopes: Directory.Read.All, Domain.Read.All, Policy.Read.All, Organization.Read.All" -ForegroundColor Yellow try { Connect-MgGraph -Scopes "Directory.Read.All", "Domain.Read.All", "Policy.Read.All", "Organization.Read.All" -NoWelcome | Out-Null $graphOrgDetails = Get-MgOrganization @@ -58,8 +58,8 @@ function Connect-M365Suite { } if ($RequiredConnections -contains "EXO" -or $RequiredConnections -contains "AzureAD | EXO" -or $RequiredConnections -contains "Microsoft Teams | EXO" -or $RequiredConnections -contains "EXO | Microsoft Graph") { - Write-Host "Connecting to Exchange Online..." -ForegroundColor Cyan - Connect-ExchangeOnline -ShowBanner $false | Out-Null + Write-Host "Connecting to Exchange Online..." -ForegroundColor Yellow + Connect-ExchangeOnline -ShowBanner:$false | Out-Null $exoTenant = (Get-OrganizationConfig).Identity $tenantInfo += [PSCustomObject]@{ Service = "Exchange Online" @@ -71,7 +71,7 @@ function Connect-M365Suite { } if ($RequiredConnections -contains "SPO") { - Write-Host "Connecting to SharePoint Online..." -ForegroundColor Cyan + Write-Host "Connecting to SharePoint Online..." -ForegroundColor Yellow Connect-SPOService -Url $TenantAdminUrl | Out-Null $spoContext = Get-SPOSite -Limit 1 $tenantInfo += [PSCustomObject]@{ @@ -84,7 +84,7 @@ function Connect-M365Suite { } if ($RequiredConnections -contains "Microsoft Teams" -or $RequiredConnections -contains "Microsoft Teams | EXO") { - Write-Host "Connecting to Microsoft Teams..." -ForegroundColor Cyan + Write-Host "Connecting to Microsoft Teams..." -ForegroundColor Yellow Connect-MicrosoftTeams | Out-Null $teamsTenantDetails = Get-CsTenant $tenantInfo += [PSCustomObject]@{