You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
EPAC PowerShell tooling should properly handle errors and display relevant error messages dynamically.
Example help script Build-ScopeTableForDeploymentRootScope.ps1 called by EPAC module cmdlet Export-AzPolicyResources crashed for a collegue of mine. As error messages are hardcoded, like this example:
Write-Error"You do not have sufficient permissions over the default context. Please set the 'defaultContext' parameter for this pacSelector in the globalSettings file"
We had little info for starting the debugging. In his example it turned out that Az modules where old, very old. And getting them up to date made this script work again.
So this had nothing to do with Azure RM permissions, like the hardcoded error message indicates.
Describe the solution you'd like
I'd like EPAC PowerShell scripts to properly handle errors, and display the actual error message/exception.
Describe alternatives you've considered
None yet.
Additional context
PowerShell v7.4.2
EnterprisePolicyAsCode v10.1.2
Az.Accounts v2.9.1 (yes, I know, dirt old 🥲 )
The text was updated successfully, but these errors were encountered:
o-l-a-v
changed the title
Catch and display errors instead of showing hardcoded error messages
EnterprisePolicyAsCode module - Catch and display errors instead of showing hardcoded error messages
Apr 23, 2024
Initial report is still valid. We'll stop intercepting the error and let azure bubble it to the user. It will be in the next version after 10.2.0, maybe named 10.2.1
Is your feature request related to a problem? Please describe.
EPAC PowerShell tooling should properly handle errors and display relevant error messages dynamically.
Example help script
Build-ScopeTableForDeploymentRootScope.ps1
called by EPAC module cmdletExport-AzPolicyResources
crashed for a collegue of mine. As error messages are hardcoded, like this example:enterprise-azure-policy-as-code/Scripts/Helpers/Build-ScopeTableForDeploymentRootScope.ps1
Line 115 in 7092b09
We had little info for starting the debugging. In his example it turned out that Az modules where old, very old. And getting them up to date made this script work again.
So this had nothing to do with Azure RM permissions, like the hardcoded error message indicates.
Describe the solution you'd like
I'd like EPAC PowerShell scripts to properly handle errors, and display the actual error message/exception.
Describe alternatives you've considered
None yet.
Additional context
The text was updated successfully, but these errors were encountered: