Closed chaoscreater closed 4 months ago
@chaoscreater - Please review the documentation and parameters section in Export-AzPolicyResources.ps1 to ensure you are using the correct parameters for your specific export. In this case, it sounds like you will want to add -IncludeChildScopes but there may be other parameters in there that help you get the desired level of export. Let me know how this works and I can investigate further if this switch doesn't work.
@chaoscreater - Please review the documentation and parameters section in Export-AzPolicyResources.ps1 to ensure you are using the correct parameters for your specific export. In this case, it sounds like you will want to add -IncludeChildScopes but there may be other parameters in there that help you get the desired level of export. Let me know how this works and I can investigate further if this switch doesn't work.
Thanks. It seems like the newer versions after 1.1.3 have changed the output. It used to contain the definitions, but now the jsonc just shows this:
{ "$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-definition-schema.json" }
Is there another parameter I need to output the definition contents?
@chaoscreater - Please review the documentation and parameters section in Export-AzPolicyResources.ps1 to ensure you are using the correct parameters for your specific export. In this case, it sounds like you will want to add -IncludeChildScopes but there may be other parameters in there that help you get the desired level of export. Let me know how this works and I can investigate further if this switch doesn't work.
Thanks. It seems like the newer versions after 1.1.3 have changed the output. It used to contain the definitions, but now the jsonc just shows this:
{ "$schema": "https://raw.githubusercontent.com/Azure/enterprise-azure-policy-as-code/main/Schemas/policy-definition-schema.json" }
Is there another parameter I need to output the definition contents?
I'm also seeing this issue
Watching ""
@chaoscreater @a8ree - I think I've found the bug and a fix. Running some test now and should have a fix in today.
@chaoscreater @a8ree - I think I've found the bug and a fix. Running some test now and should have a fix in today.
Thanks, running ok for me now
Describe the bug In my global-settings.jsonc file, I've specified a management group to target, let's call this ManagementGroupExample. This should include all policies from the child subscriptions or management groups. I'm able to get all the policy assignments just fine, but for the definitions, only the ones set on ManagementGroupExample are exported. If I take a copy of an existing policy definition that is scoped to a subscription, and then I scope this copy to ManagementGroupExample, then the export will include the definition. The definition is a custom one by the way.
I've looked at the functions in this module and it seems like the function New-EPACPolicyDefinition is the one used to generate the json. However, both this function and the function script (New-EPACPolicyDefinition.ps1) don't seem to be called by anything else.
Furthermore, under the RawDefinitions folder (found under export folder), I can see that the definitions I'm looking for are in there, but just not exported out into .jsonc format into the policyDefinitions folder.
To Reproduce Just run Export-AzPolicyResources or Export-AzPolicyResources -DefinitionsRootFolder .\Definitions -OutputFolder Output
Expected behavior All definitions starting at the target scope level, including the ones in the child subs and management group, should be exported
EPAC Version 10.1.9
Here's the output of my Powershell run: