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
403 stars 206 forks source link

Exporting policies resources for PSRule throwing exception #651

Closed tsunami28 closed 1 month ago

tsunami28 commented 1 month ago

Describe the bug When running command I get "You cannot call a method on a null-valued expression.": Export-AzPolicyResources -DefinitionsRootFolder ./ -Mode psrule -OutputFolder ./ -PSRuleIgnoreFullScope

Within screenshot you can see debugging process I went through. Seems like wrong property is being used.

To Reproduce Within global-settings.json use: "deploymentRootScope": "/subscriptions/SUBSCRIPTIONIDEXAMPLE"

Expected behavior Output files created.

Screenshots Screenshot_451

EPAC Version 10.2.11

anwather commented 1 month ago

If you change that line does it work OK? If so you can do a create a PR.

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


From: tsunami28 @.> Sent: Thursday, May 30, 2024 7:09:22 PM To: Azure/enterprise-azure-policy-as-code @.> Cc: Subscribed @.***> Subject: [Azure/enterprise-azure-policy-as-code] Exporting policies resources for PSRule throwing exception (Issue #651)

Describe the bug When running command I get "You cannot call a method on a null-valued expression.": Export-AzPolicyResources -DefinitionsRootFolder ./ -Mode psrule -OutputFolder ./ -PSRuleIgnoreFullScope

Within screenshot you can see debugging process I went through.

To Reproduce Within global-settings.json use: "deploymentRootScope": "/subscriptions/SUBSCRIPTIONIDEXAMPLE"

Expected behavior Output files created.

Screenshots Screenshot_451.png (view on web)https://github.com/Azure/enterprise-azure-policy-as-code/assets/46718446/f009a1bb-5a85-4aea-a8f3-423864916cca

EPAC Version 10.2.11

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/enterprise-azure-policy-as-code/issues/651 or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACWCJVVAL2VNE3RS7NUZG33ZE3UEFBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJLJONZXKZNENZQW2ZNLORUHEZLBMRPXI6LQMWBKK5TBNR2WLKRSG4ZDKOJYHE2DOOFENZQW2ZNJNBQXGX3MMFRGK3ECUV3GC3DVMWSHI4TVMWSG4YLNMWXHOYLUMNUF6YLDORUXM2LUPGWHG5LCNJSWG5C7OR4XAZNFJFZXG5LFUZ2G64DJMNZZHAVEOR4XAZNKOJSXA33TNF2G64TZUV3GC3DVMWUTGMZXGE3DEOBTHCBKI5DZOBS2K2LTON2WLJLWMFWHKZNKGIZTENJRGUYDKOJSQKSHI6LQMWSWYYLCMVWKK5TBNR2WLKRSG4ZDKOJYHE2DOOFHORZGSZ3HMVZKMY3SMVQXIZI. 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 1 month ago

I would ask you to update your fork to the latest version first though 😊

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


From: Anthony Watherston @.> Sent: Thursday, May 30, 2024 7:12:45 PM To: @. @.>; Azure/enterprise-azure-policy-as-code @.> Cc: Subscribed @.***> Subject: Re: [Azure/enterprise-azure-policy-as-code] Exporting policies resources for PSRule throwing exception (Issue #651)

If you change that line does it work OK? If so you can do a create a PR.

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


From: tsunami28 @.> Sent: Thursday, May 30, 2024 7:09:22 PM To: Azure/enterprise-azure-policy-as-code @.> Cc: Subscribed @.***> Subject: [Azure/enterprise-azure-policy-as-code] Exporting policies resources for PSRule throwing exception (Issue #651)

Describe the bug When running command I get "You cannot call a method on a null-valued expression.": Export-AzPolicyResources -DefinitionsRootFolder ./ -Mode psrule -OutputFolder ./ -PSRuleIgnoreFullScope

Within screenshot you can see debugging process I went through.

To Reproduce Within global-settings.json use: "deploymentRootScope": "/subscriptions/SUBSCRIPTIONIDEXAMPLE"

Expected behavior Output files created.

Screenshots Screenshot_451.png (view on web)https://github.com/Azure/enterprise-azure-policy-as-code/assets/46718446/f009a1bb-5a85-4aea-a8f3-423864916cca

EPAC Version 10.2.11

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/enterprise-azure-policy-as-code/issues/651 or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACWCJVVAL2VNE3RS7NUZG33ZE3UEFBFKMF2HI4TJMJ2XIZLTSSBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJLJONZXKZNENZQW2ZNLORUHEZLBMRPXI6LQMWBKK5TBNR2WLKRSG4ZDKOJYHE2DOOFENZQW2ZNJNBQXGX3MMFRGK3ECUV3GC3DVMWSHI4TVMWSG4YLNMWXHOYLUMNUF6YLDORUXM2LUPGWHG5LCNJSWG5C7OR4XAZNFJFZXG5LFUZ2G64DJMNZZHAVEOR4XAZNKOJSXA33TNF2G64TZUV3GC3DVMWUTGMZXGE3DEOBTHCBKI5DZOBS2K2LTON2WLJLWMFWHKZNKGIZTENJRGUYDKOJSQKSHI6LQMWSWYYLCMVWKK5TBNR2WLKRSG4ZDKOJYHE2DOOFHORZGSZ3HMVZKMY3SMVQXIZI. 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.

tsunami28 commented 1 month ago

Sure thing. I started working on this.

tsunami28 commented 1 month ago

https://github.com/Azure/enterprise-azure-policy-as-code/pull/653