Unable to export the Policies from the Policy initiative(Azure Security benchmark)

Prateek Rana 60 Reputation points
2023-05-01T02:14:05.2866667+00:00

Am unable to fetch the Polices details which are inside Definition initiative (Specific), for example I have default policy initiative ‘Nw Zealand ISM Restricted’ (BuiltIn). Below is example I have tried.  This code I found in Microsoft document but still it not working. it giving me the error that policy could not be found.Errorfile.pdf

Note : error file has been attached, Please refer it.Errorfile.pdf

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
788 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,381 Reputation points
    2023-05-01T15:39:12.67+00:00

    Hi @Prateek Rana ,

    Description of "Name" parameter of Get-AzPolicySetDefinition cmdlet says "The policy set definition name" which is not correct because "Name" parameter takes ID of the policy set definition id but not the name of the policy set definition as shown in below screenshots. So, I have raised this issue with Az PowerShell engineering team to either change the parameter name from "Name" to be more appropriate and/or update the description of the Name parameter to avoid confusion.

    Meanwhile, to get policy definition details related to a policy set definition, use below command. For illustration of sample output, check below screenshots.

    (Get-AzPolicySetDefinition |?{$_.Properties.DisplayName -eq "NIST SP 800-171 Rev. 2"}).Properties.PolicyDefinitions
    

    User's image

    User's image

    User's image

    User's image

    <<Just to let others know of the complete context of this question, it is related to this question.>>