File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- function Connect-ZtAssessment {
1+ function Connect-ZtAssessment {
22 <#
33 . SYNOPSIS
44 Helper method to connect to Microsoft Graph using Connect-MgGraph with the required scopes.
416416 }
417417
418418 if ($Service -contains ' AipService' -or $Service -contains ' All' ) {
419- Write-Host " `n Connecting to Azure Information Protection" - ForegroundColor Yellow
420- Write-PSFMessage ' Connecting to Azure Information Protection'
421-
422- try {
423- Connect-AipService - ErrorAction Stop
424- Write-Verbose " Successfully connected to Azure Information Protection."
419+ # AIPService module only works on Windows (contains Windows-only DLL)
420+ if (-not $IsWindows ) {
421+ Write-PSFMessage ' Skipping Azure Information Protection connection - AIPService module is only supported on Windows.' - Level Warning
425422 }
426- catch {
427- Write-Host " `n Failed to connect to Azure Information Protection: $_ " - ForegroundColor Red
428- Write-PSFMessage " Failed to connect to Azure Information Protection: $_ " - Level Error
423+ else {
424+ Write-Host " `n Connecting to Azure Information Protection" - ForegroundColor Yellow
425+ Write-PSFMessage ' Connecting to Azure Information Protection'
426+
427+ try {
428+ Connect-AipService - ErrorAction Stop
429+ Write-Verbose " Successfully connected to Azure Information Protection."
430+ }
431+ catch {
432+ Write-Host " `n Failed to connect to Azure Information Protection: $_ " - ForegroundColor Red
433+ Write-PSFMessage " Failed to connect to Azure Information Protection: $_ " - Level Error
434+ }
429435 }
430436 }
431437}
You can’t perform that action at this time.
0 commit comments