Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnterprisePolicyAsCode module - Catch and display errors instead of showing hardcoded error messages #581

Closed
o-l-a-v opened this issue Apr 23, 2024 · 3 comments
Assignees
Labels
bug Something isn't working investigating

Comments

@o-l-a-v
Copy link
Contributor

o-l-a-v commented Apr 23, 2024

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:

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 🥲 )
@o-l-a-v 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
@techlake techlake self-assigned this Apr 26, 2024
@techlake techlake added the bug Something isn't working label Apr 26, 2024
@chaoscreater
Copy link

Same thing and we fixed it by updating AZ modules

@techlake
Copy link
Contributor

techlake commented May 1, 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

@techlake
Copy link
Contributor

techlake commented May 2, 2024

Fixed in 10.2.1

@techlake techlake closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigating
Projects
None yet
Development

No branches or pull requests

3 participants