Azure / enterprise-azure-policy-as-code

Enterprise-ready Azure Policy-as-Code (PaC) solution (includes Az DevOps pipeline)
https://azure.github.io/enterprise-azure-policy-as-code/
MIT License
415 stars 219 forks source link

EnterprisePolicyAsCode module requires Az.Accounts 2.19.0 #596

Closed ThomasStubergh closed 4 months ago

ThomasStubergh commented 4 months ago

Today I got an error message as follows: Build-DeploymentPlans: /home/runner/work/_temp/2674b58b-6959-4c56-8dd5-d100f5a43766.ps1:2 Line | 2 | Build-DeploymentPlans -definitionsRootFolder $env:definitionsRootFold … | ~~~~~~~~~~~~~~~~~~~~~ | The 'Build-DeploymentPlans' command was found in the module | 'EnterprisePolicyAsCode', but the module could not be loaded due to the | following error: [The running command stopped because the preference | variable "ErrorActionPreference" or common parameter is set to Stop: | This module requires Az.Accounts version 2.19.0. An earlier version of | Az.Accounts is imported in the current PowerShell session. Please open a | new session before importing this module. This error could indicate that | multiple incompatible versions of the Azure PowerShell cmdlets are | installed on your system. Please see https://aka.ms/azps-version-error | for troubleshooting information.] For more information, run | 'Import-Module EnterprisePolicyAsCode'. Error: Error: The process '/usr/bin/pwsh' failed with exit code 1 I have updated to the latest release and also updated to all the latest github actions in the github pipeline, but still get this error. I can see that the Azure login Action loads Az.Accounts 2.17.0. Does this mean that I have to contact admins of Azure Login action, to get them up on Az.Accounts 2.19.0? Is Az.Accounts 2.19.0 actually required? I think I saw that 10.1.9 release specified Az.Accounts 2.15.1, but maybe I misunderstood something.

To reproduce this error: It depends on the setup. We are using github action workflow with Az OIDC login. Running the powershell build command locally works.

Expected behavior I expected the build to go through.

Screenshots From our deployment: image image

From 10.1.9 release log: image

EPAC Version v10.1.9

Thanks in advance

anwather commented 4 months ago

Very strange, 2.19.0 isn't required, I bumped the az accounts version to 2.15.1 since this what was in the latest az version loaded on the runner.

I think I'll just remove this dependency from the module until I have more time to test.

It's caused nothing but problems....

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Thomas Stubergh @.> Sent: Tuesday, April 30, 2024 6:28:49 PM To: Azure/enterprise-azure-policy-as-code @.> Cc: Subscribed @.***> Subject: [Azure/enterprise-azure-policy-as-code] EnterprisePolicyAsCode module requires Az.Accounts 2.19.0 (Issue #596)

Today I got an error message as follows: Build-DeploymentPlans: /home/runner/work/_temp/2674b58b-6959-4c56-8dd5-d100f5a43766.ps1:2 Line | 2 | Build-DeploymentPlans -definitionsRootFolder $env:definitionsRootFold … | ~~~~~ | The 'Build-DeploymentPlans' command was found in the module | 'EnterprisePolicyAsCode', but the module could not be loaded due to the | following error: [The running command stopped because the preference | variable "ErrorActionPreference" or common parameter is set to Stop: | This module requires Az.Accounts version 2.19.0. An earlier version of | Az.Accounts is imported in the current PowerShell session. Please open a | new session before importing this module. This error could indicate that | multiple incompatible versions of the Azure PowerShell cmdlets are | installed on your system. Please see https://aka.ms/azps-version-error | for troubleshooting information.] For more information, run | 'Import-Module EnterprisePolicyAsCode'. Error: Error: The process '/usr/bin/pwsh' failed with exit code 1 I have updated to the latest release and also updated to all the latest github actions in the github pipeline, but still get this error. I can see that the Azure login Action loads Az.Accounts 2.17.0. Does this mean that I have to contact admins of Azure Login action, to get them up on Az.Accounts 2.19.0? Is Az.Accounts 2.19.0 actually required? I think I saw that 10.1.9 release specified Az.Accounts 2.15.1, but maybe I misunderstood something.

To reproduce this error: It depends on the setup. We are using github action workflow with Az OIDC login. Running the powershell build command locally works.

Expected behavior I expected the build to go through.

Screenshots From our deployment: image.png (view on web)https://github.com/Azure/enterprise-azure-policy-as-code/assets/38495047/6a36bae5-376a-426a-a008-0dfb16fc9512 image.png (view on web)https://github.com/Azure/enterprise-azure-policy-as-code/assets/38495047/9b518a8b-e2e9-4ac9-afb0-9634f525e6e0

From 10.1.9 release log: image.png (view on web)https://github.com/Azure/enterprise-azure-policy-as-code/assets/38495047/5889225a-d2ed-447c-8177-d563b2322983

EPAC Version v10.1.9

Thanks in advance

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/enterprise-azure-policy-as-code/issues/596 or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACWCJVWV2EPYNREQYZW2UR3Y75I4DBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJLJONZXKZNENZQW2ZNLORUHEZLBMRPXI6LQMWBKK5TBNR2WLKRSG4ZDKOJYHE2DOOFENZQW2ZNJNBQXGX3MMFRGK3ECUV3GC3DVMWSHI4TVMWSG4YLNMWXHOYLUMNUF6YLDORUXM2LUPGWHG5LCNJSWG5C7OR4XAZNFJFZXG5LFUZ2G64DJMNZZHAVEOR4XAZNKOJSXA33TNF2G64TZUV3GC3DVMWUTGMZXGE3DEOBTHCBKI5DZOBS2K2LTON2WLJLWMFWHKZNKGIZDOMBYGQ2TMNRVQKSHI6LQMWSWYYLCMVWKK5TBNR2WLKRSG4ZDKOJYHE2DOOFHORZGSZ3HMVZKMY3SMVQXIZI. You are receiving this email because you are subscribed to this thread.

Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

anwather commented 4 months ago

@ThomasStubergh in your workflow file do you install Az.Resources by any chance?

ThomasStubergh commented 4 months ago

@ThomasStubergh in your workflow file do you install Az.Resources by any chance?

@anwather Thanks for quick feedback. No, We only use these three: image

anwather commented 4 months ago

Can you share the workflow file? Email me at anwather@microsoft.com if you want to

ThomasStubergh commented 4 months ago

Can you share the workflow file? Email me at anwather@microsoft.com if you want to

Sure! Give me a few secs.

ThomasStubergh commented 4 months ago

It's sent. Let me know if i arrives. If not I guess I will have to zip.

anwather commented 4 months ago

Nope all good I got it - just testing something. Looks like the Az.ResourceGraph module installs 2.19.0 now - I might do a quick bump of the required version up to 2.19.0 and push a new module to test quickly - if it doesn't work I'll just remove the dependancy to get it going again

anwather commented 4 months ago

@ThomasStubergh - can you try running again please?

ThomasStubergh commented 4 months ago

@ThomasStubergh - can you try running again please?

@anwather The Build works again now!

anwather commented 4 months ago

OK good to hear 😊

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Thomas Stubergh @.> Sent: Tuesday, April 30, 2024 7:35:15 PM To: Azure/enterprise-azure-policy-as-code @.> Cc: Comment @.>; Assign @.>; Subscribed @.***> Subject: Re: [Azure/enterprise-azure-policy-as-code] EnterprisePolicyAsCode module requires Az.Accounts 2.19.0 (Issue #596)

@ThomasStuberghhttps://github.com/ThomasStubergh - can you try running again please?

The Build works again now!

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/enterprise-azure-policy-as-code/issues/596#issuecomment-2084833605 or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACWCJVQPHMPOZIKWWWX5CGDY75QVJBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLAVFOZQWY5LFVIZDOMRVHE4DSNBXHCSG4YLNMWUWQYLTL5WGCYTFNSWHG5LCNJSWG5C7OR4XAZNMJFZXG5LFINXW23LFNZ2KM5DPOBUWG44TQKSHI6LQMWVHEZLQN5ZWS5DPOJ42K5TBNR2WLKJTGM3TCNRSHAZTRAVEOR4XAZNFNFZXG5LFUV3GC3DVMWVDEMRXGA4DINJWGY2YFJDUPFYGLJLMMFRGK3FFOZQWY5LFVIZDOMRVHE4DSNBXHCTXI4TJM5TWK4VGMNZGKYLUMU. You are receiving this email because you commented on the thread.

Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ThomasStubergh commented 4 months ago

Thanks for the help and quick response! @anwather