Skip to content

Commit 292d64f

Browse files
committed
update errors to reference Setup Wizard instead of SAM
1 parent 46a49a8 commit 292d64f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Modules/CIPPCore/Public/GraphHelper/Get-NormalizedError.ps1

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ function Get-NormalizedError {
33
.FUNCTIONALITY
44
Internal
55
#>
6+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingEmptyCatchBlock', '', Justification = 'CIPP does not use this function to catch errors')]
67
[CmdletBinding()]
78
param (
89
[string]$message
@@ -21,16 +22,16 @@ function Get-NormalizedError {
2122

2223
#We need to check if the message is in one of these fields, and if so, return it.
2324
if ($JSONMsg.error.innererror.message) {
24-
Write-Host "innererror.message found: $($JSONMsg.error.innererror.message)"
25+
Write-Information "innererror.message found: $($JSONMsg.error.innererror.message)"
2526
$message = $JSONMsg.error.innererror.message
2627
} elseif ($JSONMsg.error.message) {
27-
Write-Host "error.message found: $($JSONMsg.error.message)"
28+
Write-Information "error.message found: $($JSONMsg.error.message)"
2829
$message = $JSONMsg.error.message
2930
} elseif ($JSONMsg.error.details.message) {
30-
Write-Host "error.details.message found: $($JSONMsg.error.details.message)"
31+
Write-Information "error.details.message found: $($JSONMsg.error.details.message)"
3132
$message = $JSONMsg.error.details.message
3233
} elseif ($JSONMsg.error.innererror.internalException.message) {
33-
Write-Host "error.innererror.internalException.message found: $($JSONMsg.error.innererror.internalException.message)"
34+
Write-Information "error.innererror.internalException.message found: $($JSONMsg.error.innererror.internalException.message)"
3435
$message = $JSONMsg.error.innererror.internalException.message
3536
}
3637

@@ -46,7 +47,7 @@ function Get-NormalizedError {
4647
'*User was not found.*' { 'The relationship between this tenant and the partner has been dissolved from the tenant side.' }
4748
'*AADSTS50020*' { 'AADSTS50020: The user you have used for your Secure Application Model is a guest in this tenant, or your are using GDAP and have not added the user to the correct group. Please delete the guest user to gain access to this tenant' }
4849
'*AADSTS50177' { 'AADSTS50177: The user you have used for your Secure Application Model is a guest in this tenant, or your are using GDAP and have not added the user to the correct group. Please delete the guest user to gain access to this tenant' }
49-
'*invalid or malformed*' { 'The request is malformed. Have you finished the SAM Setup?' }
50+
'*invalid or malformed*' { 'The request is malformed. Have you finished the Setup Wizard' }
5051
'*Windows Store repository apps feature is not supported for this tenant*' { 'This tenant does not have WinGet support available' }
5152
'*AADSTS650051*' { 'The application does not exist yet. Try again in 30 seconds.' }
5253
'*AppLifecycle_2210*' { 'Failed to call Intune APIs: Does the tenant have a license available?' }
@@ -58,15 +59,15 @@ function Get-NormalizedError {
5859
'*Authentication failed. MFA required*' { 'Authentication failed. MFA required' }
5960
'*Your tenant is not licensed for this feature.*' { 'Required license not available for this tenant' }
6061
'*AADSTS65001*' { 'We cannot access this tenant as consent has not been given, please try refreshing the CPV permissions in the application settings menu.' }
61-
'*AADSTS700082*' { 'The CIPP user access token has expired. Run the SAM Setup wizard to refresh your tokens.' }
62+
'*AADSTS700082*' { 'The CIPP user access token has expired. Run the Setup Wizard to refresh your tokens.' }
6263
'*Account is not provisioned.' { 'The account is not provisioned. You do not the correct M365 license to access this information..' }
6364
'*AADSTS5000224*' { 'This resource is not available - Has this tenant been deleted?' }
6465
'*AADSTS53003*' { 'Access has been blocked by Conditional Access policies. Please check the Conditional Access configuration documentation' }
6566
'*AADSTS900023*' { 'This tenant is not available for this operation. Please check the selected tenant and try again.' }
6667
'*AADSTS9002313*' { 'The credentials used to connect to the Graph API are not available, please retry. If this issue persists you may need to execute the SAM wizard.' }
6768
'*One or more platform(s) is/are not configured for the customer. Please configure the platform before trying to purchase a SKU.*' { 'One or more platform(s) is/are not configured for the customer. Please configure the platform before trying to purchase a SKU.' }
6869
"One or more added object references already exist for the following modified properties: 'members'." { 'This user is already a member of the selected group.' }
69-
Default { $message }
70+
default { $message }
7071

7172
}
7273
}

0 commit comments

Comments
 (0)