Hi @Juan Alicea
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
To copy a policy definition in Azure Policy along with its details, you can use either Azure CLI or Azure PowerShell. However, keep in mind that some details might not copy exactly as expected through the portal UI.
- Using Azure CLI: First, export the existing policy definition to a JSON file using the az policy definition show command. Then, update the JSON file with any changes you want. Finally, use the az policy definition create command to create a new policy based on the updated JSON.
- Using Azure PowerShell: You can use the Get-AzPolicyDefinition cmdlet to fetch the existing policy definition. Modify the retrieved policy and then create a new one using New-AzPolicyDefinition.
Note that some metadata, like metadataId, is read-only and can't be changed or copied. This means there might be slight differences in the structure when you create the duplicate policy.
If you're having trouble copying certain metadata correctly, make sure to carefully check the properties in the JSON or PowerShell objects and adjust them if needed.
If you have any concerns, please go through this link: -
If you have any further queries, do let us know
If the answer is helpful, please click and "Upvote it"