fix: added warning for subsequent runs when using auth object

This commit is contained in:
DrIOS
2024-12-26 13:00:31 -06:00
parent ac5274d9f6
commit 330f399b41
2 changed files with 3 additions and 2 deletions

View File

@@ -41,11 +41,9 @@ function Assert-ModuleAvailability {
Write-Verbose "Importing module $ModuleName..."
Import-Module -Name $ModuleName -RequiredVersion $RequiredVersion -ErrorAction Stop -WarningAction SilentlyContinue | Out-Null
}
}
catch {
throw "Assert-ModuleAvailability:`n$_"
}
}
}

View File

@@ -119,6 +119,9 @@ function Connect-M365Suite {
Write-Verbose "Tenant Context: $($tenant.TenantName)`n"
#Write-Verbose "Tenant ID: $($tenant.TenantID)"
}
if ($script:PnpAuth) {
Write-Warning "`n!!!!!!!!!!!!Important!!!!!!!!!!!!!!`nIf you use auth tokens, you will need to kill the current session before subsequent runs as the PNP.Powershell module has conflicts with MgGraph!`n!!!!!!!!!!!!Important!!!!!!!!!!!!!!"
}
$confirmation = Read-Host "Do you want to proceed with these connections? (Y/N)"
if ($confirmation -notLike 'Y') {
Write-Verbose "Connection setup aborted by user."