Skip to content

Commit db8c3ef

Browse files
committed
Update Connect-ZtAssessment.ps1
1 parent 556f636 commit db8c3ef

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/powershell/public/Connect-ZtAssessment.ps1

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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.
@@ -416,16 +416,22 @@
416416
}
417417

418418
if ($Service -contains 'AipService' -or $Service -contains 'All') {
419-
Write-Host "`nConnecting 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 "`nFailed 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 "`nConnecting 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 "`nFailed to connect to Azure Information Protection: $_" -ForegroundColor Red
433+
Write-PSFMessage "Failed to connect to Azure Information Protection: $_" -Level Error
434+
}
429435
}
430436
}
431437
}

0 commit comments

Comments
 (0)