diff --git a/src/functions/Initialize-AzOpsEnvironment.ps1 b/src/functions/Initialize-AzOpsEnvironment.ps1 index d0939a6b..fb7d8627 100644 --- a/src/functions/Initialize-AzOpsEnvironment.ps1 +++ b/src/functions/Initialize-AzOpsEnvironment.ps1 @@ -119,8 +119,11 @@ $managementGroups = Get-AzManagementGroup -ErrorAction Stop } catch { - Write-AzOpsMessage -LogLevel Warning -LogString 'Initialize-AzOpsEnvironment.ManagementGroup.NoManagementGroupAccess' - return + if ($_.Exception.Message -match 'does not have authorization to perform action ''Microsoft.Management/register/action''') { + Write-AzOpsMessage -LogLevel Warning -LogString 'Initialize-AzOpsEnvironment.ManagementGroup.InsufficientPermissions' + } else { + Write-AzOpsMessage -LogLevel Warning -LogString 'Initialize-AzOpsEnvironment.ManagementGroup.NoManagementGroupAccess' + } } #region Validate root '/' permissions - different methods of getting current context depending on principalType